toolchest.logging

Interface to get a configured logger

toolchest.logging.logger.getLogger(config=None)[source]

Returns a logger object of the type specified.

Parameters

config – Dictionary of values to configure the desired logger object.

For example, to use the default python logger, you can either simply pass None, or specify any details supported by the toolchest default driver for the python logger. You would specify the default logger (with custom loglevel) with:

{'driver':'toolchest.logging.drivers.default',
'root':{'level':DEBUG}}

The toolchest logging wrapper code specifies a toplevel element in the config dict of ‘driver’, pointing at the driver that will load the desired configuration and return a logger to use.

Each driver must implement getLogger, so we can invoke it the same way from this interface. In theory, drivers could be released as separate modules.

Implementation of a driver that uses the standard python logger.

toolchest.logging.drivers.default.getLogger(config)[source]

Returns a python stdlib logger

Parameters

config – Dictionary of values meeting the criteria in the Configuration dictionary schema.