mgkit.logger module

Module configuring log information

class mgkit.logger.ColorFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

colors = {'CRITICAL': 'red', 'DEBUG': 'blue', 'ERROR': 'magenta', 'INFO': 'green', 'WARNING': 'yellow'}
format(record)
mgkit.logger.config_log(level=10, output=<open file '<stderr>', mode 'w'>)

Minimal configuration of :mod`logging` module, default to debug level and the output is printed to standard error

Parameters:
  • level (int) – logging level
  • output (file) – file to which write the log
mgkit.logger.config_log_to_file(level=10, output=None)

New in version 0.1.14.

Minimal configuration of :mod`logging` module, default to debug level and the output is printed to script name, using sys.argv[0].

Parameters:
  • level (int) – logging level
  • output (file) – file to which write the log