caf.toolkit.log_helpers#

Helper functions for creating and managing a logger.

This module is designed to initialise Python logging consistently and automatically log tool and system information.

Classes#

LogHelper

Main context manager class for creating and managing loggers and logging key tool / system information.

TemporaryLogFile

Context manager for adding a log file handler to a logger and removing it when done.

Functions

capture_warnings([stream_handler, ...])

Capture warnings using logging.

get_console_handler([ch_format, ...])

Create a console handles for a logger.

get_custom_logger(logger_name, code_version)

Create a standard logger using the CAF template.

get_file_handler(log_file[, fh_format, ...])

Create a console handles for a logger.

get_logger(logger_name, code_version[, ...])

Create a standard logger using the CAF template.

write_information(logger[, tool_details, ...])

Write tool and system information to logger.

write_instantiate_message(logger, ...)

Write an instantiation message to logger.

Classes

Annotated(*args, **kwargs)

Add context-specific metadata to a type.

Any(*args, **kwargs)

Special type indicating an unconstrained type.

LogHelper(root_logger, tool_details, *[, ...])

Class for managing Python loggers.

SystemInformation(user, pc_name, ...)

Information about the PC and Python version.

TemporaryLogFile(logger, log_file[, ...])

Add temporary log file to a logger.

ToolDetails(name, version[, homepage, ...])

Information about the current tool.

Exceptions

LoggingWarning

Warnings from LogHelper and other toolkit logging functionality.