nboost.logger module

Logger for NBoost classes

class nboost.logger.ColoredFormatter(fmt=None, datefmt=None, style='%')[source]

Bases: logging.Formatter

Format log levels with color

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 datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.

Use a style parameter of ‘%’, ‘{‘ or ‘$’ to specify that you want to use one of %-formatting, str.format() ({}) formatting or string.Template formatting in your format string.

Changed in version 3.2: Added the style parameter.

MAPPING = {'CRITICAL': {'color': 'grey', 'on_color': 'on_blue'}, 'DEBUG': {'color': 'green', 'on_color': None}, 'ERROR': {'color': 'grey', 'on_color': 'on_red'}, 'INFO': {'color': 'cyan', 'on_color': None}, 'WARNING': {'color': 'yellow', 'on_color': None}}
PREFIX = '\x1b['
SUFFIX = '\x1b[0m'

Add log ansi colors

class nboost.logger.NTLogger(context, verbose)[source]

Bases: object

Windows support for logger


Format incoming logging messages with a given format

nboost.logger.set_logger(context, verbose=False)[source]

Return colored logger with specified context name and debug=verbose