fatbotslim.log

This module contains everything useful to enable logging.

class fatbotslim.log.ColorFormatter(fmt=None, datefmt=None)[source]

A logging formatter that displays the loglevel with colors and the logger name in bold.

Initialize the formatter with specified format strings.

Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument (if omitted, you get the ISO8601 format).

format(record)[source]

Overrides the default logging.Formatter.format() to add colors to the record‘s levelname and name attributes.

fatbotslim.log.create_logger(name, level='INFO')[source]

Creates a new ready-to-use logger.

Parameters:
  • name (str) – new logger’s name
  • level (str or int) – default logging level.
Returns:

new logger.

Return type:

logging.Logger