Logger#
- class ansys.tools.common.logger.Logger(level: int = logging.ERROR, logger_name: str = 'Logger', column_width: int = 15)#
Bases:
objectProvides the singleton logger.
Parameters#
- levelint, default:
logging.ERROR Output level of the logger.
- logger_namestr, default:
"Logger" Name of the logger.
- column_widthint, default:
15 Maximum width of the module and function names in the log output.
- levelint, default:
Overview#
Get the logger. |
|
Set the logger output level. |
|
Enable logger output to a given stream. |
|
Save logs to a file in addition to printing them to the standard output. |
|
Log a message with level DEBUG. |
|
Log a message with level INFO. |
|
Log a message with level WARNING. |
|
Log a message with level WARNING. |
|
Log a message with level ERROR. |
|
Log a message with level CRITICAL. |
|
Log a message with level FATAL. |
|
Log a message with a specified level. |
Import detail#
from ansys.tools.common.logger import Logger
Method detail#
- Logger.set_level(level: int)#
Set the logger output level.
Parameters#
- levelint
Output level of the logger.
- Logger.enable_output(stream=None)#
Enable logger output to a given stream.
If a stream is not specified,
sys.stderris used.Parameters#
- stream: TextIO, default:
None Stream to output the log output to.
- stream: TextIO, default:
- Logger.add_file_handler(logs_dir: str | pathlib.Path = '.log')#
Save logs to a file in addition to printing them to the standard output.
Parameters#
- logs_dirstr or Path, default:
".log" Directory to save the log file to. If it does not exist, it is created.
- logs_dirstr or Path, default:
- Logger.debug(*args, **kwargs)#
Log a message with level DEBUG.
- Logger.info(*args, **kwargs)#
Log a message with level INFO.
- Logger.warning(*args, **kwargs)#
Log a message with level WARNING.
- Logger.warn(*args, **kwargs)#
Log a message with level WARNING.
- Logger.error(*args, **kwargs)#
Log a message with level ERROR.
- Logger.critical(*args, **kwargs)#
Log a message with level CRITICAL.
- Logger.fatal(*args, **kwargs)#
Log a message with level FATAL.
- Logger.log(level, msg, *args, **kwargs)#
Log a message with a specified level.