panda_autograsp.loggers

Utility class for logging. This class is a wrapper around the original logging module logging and can be used to apply the panda_autograsp formatters, filters and handlers to the logging object.

Functions

add_root_log_file(log_file[, mode, …]) Add a log file to the root logger.
clear_root() Function used to reset the root logger.
configure_root([log_level]) Function used to configure the root logger.

Classes

Logger Panda autograsp Logger class.
panda_autograsp.loggers.clear_root()[source]

Function used to reset the root logger.

panda_autograsp.loggers.configure_root(log_level=20)[source]

Function used to configure the root logger.

Parameters:log_level (int, optional) – The log level, by default ROOT_LOG_LEVEL
Returns:Root logger.
Return type:Logger
panda_autograsp.loggers.add_root_log_file(log_file, mode='a', encoding=None, delay=False)[source]

Add a log file to the root logger.

Parameters:
  • log_file (str) – The path to the log file.
  • mode (str) – Log file writing mode, by default ‘a’.
  • encoding (str) – File encoding used, by default None.
  • delay (str) – If delay is true, then file opening is deferred until the first call to emit(), by default False.
class panda_autograsp.loggers.Logger[source]

Panda autograsp Logger class.

static clear_root()[source]

Reset root logger.

static reconfigure_root()[source]

Reconfigure the root logger.

static get_logger(name=None, log_level=20, log_file=None, silence=False, mode='a', encoding=None, delay=False)[source]

Build a logger. All logs will be propagated up to the root logger if not silenced. If log_file is provided, logs will be written out to that file. If no logger name is given, log_file will be handed the root logger, otherwise it will only be used by this particular logger.

Parameters:
  • name (str) – The name of the logger to be built, by default “” thus formatting the root logger.
  • log_level (int) – The log level. See the python logging module documentation for possible enum values.
  • log_file (str) – The path to the log file to log to.
  • silence (bool) – Whether or not to silence this logger. If it is silenced, the only way to get output from this logger is through a non-global log file.
  • mode (str) – Log file writing mode, by default ‘a’.
  • encoding (str) – File encoding used, by default None.
  • delay (str) – If delay is true, then file opening is deferred until the first call to emit(), by default False.
Returns:

A custom logger.

Return type:

Logger

static add_log_file(log_file=None, logger=None, mode='a', encoding=None, delay=False)[source]

Add a log file to this logger. If no logger is given, log_file will be handed the root logger, otherwise it will only be used by this particular logger.

Parameters:
  • log_file (str) – The path to the log file to log to.
  • logger (logging.Logger) – The logger.
  • mode (str) – Log file writing mode, by default ‘a’.
  • encoding (str) – File encoding used, by default None.
  • delay (str) – If delay is true, then file opening is deferred until the first call to emit(), by default False.