qom.ui.log module

UI module to format logging.

class qom.ui.log.FullFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: Formatter

Class to customize logging format.

The class inherits logging.Formatter.

formatTime(record, datefmt=None)

Overriding method to display milliseconds in the time format.

Parameters:
  • record (logging.LogRecord) – Current record to log.

  • datefmt (str) – Date format for log.

Returns:

f_time – Formatted time.

Return type:

str

qom.ui.log.get_formatter(log_format='full')

Function to obtain the formatter for stream handler.

Parameters:

log_format (str, optional) – Format type for output to console.

Returns:

formatter – Formatter for stream handler.

Return type:

logging.Formatter

qom.ui.log.get_handler(formatter)

Function to obtain the stream handler for console logger.

Parameters:

formatter (logging.Formatter) – Formatter for stream handler.

Returns:

handler – Stream handler for console logger.

Return type:

logging.StreamHandler

qom.ui.log.init_log(log_format='full', debug=False, parallel=False)

Function to initialize the logger for the package.

Parameters:
  • log_format (str) – Format type for output to console.

  • debug (boolean, optional) – Option to enable DEBUG log level.

  • parallel (boolean, optional) – Option to only display errors when running code in parallel

Returns:

logger – Logger for output to console.

Return type:

logging.Logger