booldog.utils.logger

Functions

setup_logger([level])

Configure the 'booldog' logger with a console handler.

Module Contents

booldog.utils.logger.setup_logger(level=logging.INFO)

Configure the 'booldog' logger with a console handler.

Retrieves the logger named 'booldog' (the parent logger for all booldog submodules, which each call logging.getLogger(__name__)), sets its level to level, attaches a logging.StreamHandler writing to the console with the format '%(levelname)s %(asctime)s %(name)s:%(funcName)s %(message)s', and disables propagation to the root logger (logger.propagate = False) so messages are not also emitted by any handlers attached higher up.

Parameters:

level (int, default logging.INFO) – The logging level to set on the 'booldog' logger (e.g. logging.DEBUG, logging.INFO, logging.WARNING).

Return type:

None

Notes

Calling this function more than once attaches an additional logging.StreamHandler to the 'booldog' logger each time, since it does not check for or remove handlers that were added by a previous call; this results in duplicated console output if setup_logger is called repeatedly.