logger package

Submodules

logger.logger module

class logger.logger.CustomLogger(name, log_dir=None)[source]

Bases: Logger

add_file_handler(name, log_dir)[source]

Add a file handler for this logger with the specified name (and store the log file under log_dir).

disable_console_output()[source]
disable_file_output()[source]
enable_console_output()[source]
enable_file_output()[source]
has_console_handler()[source]
has_file_handler()[source]
class logger.logger.FileOutFormatter[source]

Bases: Formatter

fmt = '%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s'
format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

class logger.logger.StdOutFormatter[source]

Bases: Formatter

FORMATS = {10: '\x1b[38;20m%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s\x1b[0m', 20: '\x1b[34m%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s\x1b[0m', 30: '\x1b[33;20m%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s\x1b[0m', 40: '\x1b[31;20m%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s\x1b[0m', 50: '\x1b[31;1m%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s\x1b[0m'}
blue = '\x1b[34m'
bold_red = '\x1b[31;1m'
fmt = '%(asctime)s | %(levelname)8s | %(filename)s:%(lineno)d | %(message)s'
format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

grey = '\x1b[38;20m'
red = '\x1b[31;20m'
reset = '\x1b[0m'
yellow = '\x1b[33;20m'

Module contents

logger.get_logger() CustomLogger[source]