juturna.utils.log_utils package

Module contents

class juturna.utils.log_utils.ColoredFormatter(fmt=None, datefmt=None, style='%')

Bases: Formatter

BOLD = '\x1b[1m'
COLORS = {'CRITICAL': '\x1b[35m', 'DEBUG': '\x1b[36m', 'ERROR': '\x1b[31m', 'INFO': '\x1b[32m', 'WARNING': '\x1b[33m'}
RESET = '\x1b[0m'
format(record)

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 juturna.utils.log_utils.JsonFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: Formatter

format(record)

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 juturna.utils.log_utils.JuturnaFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: Formatter

format(record)

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 juturna.utils.log_utils.JuturnaPipelineFilter(name='')

Bases: Filter

filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

classmethod register_pipeline(pipe_name: str, extras: dict)
classmethod reserved() list
classmethod unregister_pipeline(pipe_name: str)
juturna.utils.log_utils.add_extra(logger_name: str, extra: dict)
juturna.utils.log_utils.add_formatter(name: str, formatter: Formatter)
juturna.utils.log_utils.add_handler(handler: Handler, formatter: str | Formatter = '')
juturna.utils.log_utils.drop_extra(logger_name: str)
juturna.utils.log_utils.formatter(formatter_name: str = '') str | None
juturna.utils.log_utils.formatters() list
juturna.utils.log_utils.jt_logger(logger_name: str = '') Logger