penguin.common module¶
- class penguin.common.PathHighlightingFormatter(fmt=None, datefmt=None, style='%', level_styles=None, field_styles=None)[source]¶
Bases:
ColoredFormatter- format(record)[source]¶
Apply level-specific styling to log records.
- Parameters:
record – A
LogRecordobject.- Returns:
The result of
logging.Formatter.format().
This method injects ANSI escape sequences that are specific to the level of each log record (because such logic cannot be expressed in the syntax of a log format string). It works by making a copy of the log record, changing the msg field inside the copy and passing the copy into the
format()method of the base class.