tlcconfig.logger_configurator#

Logging configuration for the 3LC module, supporting default and customizable configurations.

Module Contents#

Classes#

Class

Description

LoggerConfigurator

LoggerConfigurator provide an interface to configure the 3LC logger prior to importing the tlc module.

Functions#

Function

Description

default_log_file_handler

Returns the default log fileHandler

default_dictConfig

Return the default configuration for the 3LC logger.

API#

tlcconfig.logger_configurator.default_log_file_handler() dict[str, Any]#

Returns the default log fileHandler

tlcconfig.logger_configurator.default_dictConfig() dict#

Return the default configuration for the 3LC logger.

This function return the base logging config, that can be adapted by a LoggerConfigurator instance.

Returns: A dict compatible with the logging.config.dictConfig() function.

class tlcconfig.logger_configurator.LoggerConfigurator(dictConfig: dict[str, Any] | None = None)#

LoggerConfigurator provide an interface to configure the 3LC logger prior to importing the tlc module.

LoggerConfigurator provides an interface to configure a dictionary which corresponds to version 1 of the dictConfig API. An instance of such a dictionary can be set as a class variable on the LoggerConfigurator-class, and it will be used to configure the 3LC logger when the tlc module is imported.

Once a dictConfig is fully configured, the user must call initialize_logging_config in order to set the class variable that will be used to configure the 3LC logger.

It is possible to initialize the class with a custom dictConfig to, the user is then fully responsible for this dictConfig to be valid.

initialize_logging_config() None#

Initialize the Python logging system with this configuration.

Initializing configuration should be a one-time operation done on startup. Multiple applications automatically trigger incremental configuration of the logger. See the Python logging config documentation for more details about incremental configuration.

static instance() tlcconfig.logger_configurator.LoggerConfigurator#

Returns the singleton LoggerConfigurator object.

set_log_level(log_level: str) None#

Set the log level for the 3LC logger.

Parameters:

log_level – The log level to set. Must be one of “DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”.

enable_log_file() None#

Enable use of a logfile for the 3LC logger.