wsgidav.util.init_logging

wsgidav.util.init_logging(config)[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.

Module loggers (e.g ‘wsgidav.lock_man.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.init_logging().

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.get_module_logger(__name__)
[..]
_logger.debug("foo: '{}'".format(s))

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

config.logging.enable_loggers = ["lock_manager",
                  "property_manager",
                 ]
util.init_logging(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