toolrack.log

Logging helpers.

The Loggable mixin provides a logger attribute with a configured logger using the class name (including the module path) as logger name.

toolrack.log.LOG_FORMAT = '%(asctime)s - %(levelname)s - %(name)s - %(message)s'

Default format for logging to a stream

class toolrack.log.Loggable

Mixin class providing a logger attribute.

logger

Decorator to a class method a cached property.

The property method is called just the first time for an instance, and its result cached.

toolrack.log.setup_logger(name=None, stream=None, level=None, format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')

Helper to setup a logger with a default handler.

Parameters:
  • name (str) – the name of the logger. If not specified, the root logger is used.
  • stream – an output stream for the log handler. If not specified, the null handler is installed.
  • level – the minimum log level for the logger.