gfw.common.logging.LoggerConfig#
- class LoggerConfig(format_='%(asctime)s - %(name)s - %(message)s', warning_level=(), error_level=())[source]#
Helper class to setup the root logger.
- Parameters:
Methods
Initializes and configures the root logger.
Attributes
error_levelformat_warning_level- setup(verbose=False, rich=True, log_file=None, log_stream=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>)[source]#
Initializes and configures the root logger.
- Parameters:
verbose (bool) – If true, turns logger level to
DEBUG.rich (bool) – Whether to use Rich library to colorize console output.
log_file (str | Path | None) – Path to file in which to save logs.
log_stream (TextIO) – Destination stream for log output. Defaults to
sys.stderr. Typically set tosys.stdoutorsys.stderr, but can be any text-mode file-like object (e.g. an open file orio.StringIO) that implements awrite(str)method. Ignored ifrich=True, sinceRichHandlermanages its own output stream.
- Return type: