Logger

class pycomo.helper.logger.RegexFilter(pattern)

Filter incoming warning messages with regex patterns. Intended for common warnings of imported packages, that are expected with correct behaviour of PyCoMo.

filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

pycomo.helper.logger.configure_logger(level=None, log_file=None, instance_name=None, with_name=None)

Configure the logger with log-level and/or log file location.

Parameters:
  • level – One of: “debug”, “info”, “warning”, “error”

  • log_file – Location for the log file

  • instance_name – Set an instance name for the logger name

  • with_name – Set the logger name to this string

pycomo.helper.logger.get_logger(name=None)

Return the configured logger or a logger by name. If no logger configured, configure default one.

Parameters:

name – The name to get the logger by

Returns:

The logger

pycomo.helper.logger.get_logger_conf()

Get the current configuration of the logger (logger name, level and file location).

Returns:

tuple of logger-name, log-level and log-filename

pycomo.helper.logger.get_logger_name()

Get the current configuration of the logger (logger name, level and file location).

Returns:

tuple of logger-name, log-level and log-filename

pycomo.helper.logger.temporary_logger_filter(logger_name, filter_instance)

Create a temporary filter for the logger.

Parameters:
  • logger_name – Name of the logger

  • filter_instance – Filter to apply