Attention

You are looking at outdated documentation for version 2.x. A newer version is available.

wsgidav.util.initLogging

wsgidav.util.initLogging(verbose=3, enable_loggers=None)[source]

Initialize base logger named ‘wsgidav’.

The base logger is filtered by the verbose configuration option. Log entries will have a time stamp and thread id.

Parameters:
verbose : int

Verbosity configuration (0..5)

enable_loggers : string list

List of module logger names, that will be switched to DEBUG level.

Module loggers (e.g ‘wsgidav.lock_manager’) are named loggers, that can be independently switched to DEBUG mode.

Except for verbosity, they will inherit settings from the base logger.

They will suppress DEBUG level messages, unless they are enabled by passing their name to util.initLogging().

If enabled, module loggers will print DEBUG messages, even if verbose == 3.

Example initialize and use a module logger, that will generate output, if enabled (and verbose >= 2):

_logger = util.getModuleLogger(__name__)
[..]
_logger.debug("foo: '{}'".format(s))

This logger would be enabled by passing its name to initLogging():

enable_loggers = ["lock_manager",
                  "property_manager",
                 ]
util.initLogging(2, enable_loggers)
Verbose level Option Log level
base logger module logger(default) module logger(enabled)
0 -qqq CRITICAL CRITICAL CRITICAL
1 -qq ERROR ERROR ERROR
2 -q WARN WARN WARN
3   INFO INFO DEBUG
4 -v DEBUG DEBUG DEBUG
5 -vv DEBUG DEBUG DEBUG