dqm.utils package

Submodules

dqm.utils.twe_logger module

The confiance_logger module provides a preconfigured logger for logging messages with specified formatting and output control. It can log messages to the standard output, to a specified file, or both.

Usage:
Import the module and get the default logger:

import twe_logger logger = twe_logger.get_logger()

If you need a logger with different parameters, call get_logger with the desired parameters:

logger = twe_logger.get_logger(filename=”my_logs.log”) logger = twe_logger.get_logger(name=”my_logger”, level=’debug’, filename=’my_logs.log’, output=”both”)

Then, use the logger within your code:

logger.info(“This is an info message”) logger.error(“This is an error message”)

dqm.utils.twe_logger.get_logger(name='twe_logger', level='debug', filename=None, output=None)[source]

Creates and returns a logger.

Parameters:
  • name (str, optional) – The name of the logger.

  • level (int or str, optional) – The logging level.

  • filename (str, optional) – The name of the file where the logger should write.

  • output (str, optional) – Where should the logger write. Can be ‘stdout’, ‘file’, or ‘both’.

Returns:

The logger.

Return type:

logging.Logger

dqm.utils.twe_logger.log_str_to_level(str_level)[source]

Converts a string to a corresponding logging level.

Parameters:

str_level (str) – The logging level as a string.

Returns:

The corresponding logging level.

Return type:

int

Module contents