pyrnaither.logging.logger module

class pyrnaither.logging.logger.ColorFormatter[source]

Bases: Formatter

Custom formatter to add colors and file information to log messages.

Args:

logging.Formatter: Base formatter class

__init__()[source]

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.

format(record)[source]

Format log messages with color and file information.

Args:

record: Log record to format

Returns:

Formatted log message

pyrnaither.logging.logger.handle_exception(exc_type, exc_value, exc_traceback)[source]

Global exception handler with file information.

pyrnaither.logging.logger.setup_logger(debug_mode=False, log_level=20)[source]

Set up the logger with file information and colors.