The Log Utils Module (tendril.utils.log)

This module provides utilities to deal with logging systems. The intent of having this module instead of using logging directly is to allow the injection of various default parameters and options into all the loggers used from a central place, instead of littering them throughout the modules.

At present, this module does nothing that is overly useful, except for being able to set the default log level for all modules simultaneously.

Usage Example

>>> from tendril.utils import log
>>> logger = log.get_logger(__name__, log.DEFAULT)
tendril.utils.log.DEFAULT = 30

The default log level for all loggers created through this module, unless otherwise specified at the time of instantiation.

tendril.utils.log.init()[source]
tendril.utils.log.get_logger(name, level=None)[source]

Get a logger with the specified name and an optional level.

The levels from the python logging module can be used directly. For convenience, these levels are imported into this module’s namespace as well, along with the DEFAULT level this module provides.

See python logging documentation for information about log levels.

Parameters:
  • name (str) – The name of the logger
  • level (int) – Log level of the logger to be used. Default : DEFAULT.
Returns:

The logger instance