Logging#

dlisio is using Python’s standard library logging module to emit several logs. dlisio only supplies the loggers, while configuring them is left to the user. If not, the logging modules default configuration applies.

For example, next may be done to make all modules to print to stderr info messages, not just warnings and errors as it happens by default:

>>> import logging
>>> logger = logging.getLogger('dlisio')
>>> logger.setLevel(logging.DEBUG)
>>> ch = logging.StreamHandler()
>>> ch.setLevel(logging.INFO)
>>> formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
>>> ch.setFormatter(formatter)
>>> logger.addHandler(ch)