# Module k.log

Part of kiwi

Extension to the logging module

This module defines a couple of extensions to the logging module included in the python standard distribution.

It creates an additional logging handler that print log records on the standard output. This handler is only showing records which has a level set to logging.WARNING or higher by default. The messages printed by this handler can be modified by using the environment variable called KIWI_LOG.

The syntax for the string which KIWI_LOG points to is the following:

       domain ':' level [, domain ':', level]

domain can contain wildcards such as * and ? level is an integer 1-5 which defines the minimal level:

- 5: DEBUG
- 4: INFO
- 3: WARNING
- 2: ERROR
- 1: CRITICAL

Examples:

       KIWI_LOG="stoq*:5"

will print all the messages in a domain starting with stoq with DEBUG or higher:

       KIWI_LOG="kiwi*:4,stoq.*:5"

will print all the messages with INFO or higher in all domains starting with kiwi, and all the messages in the stoq.* domains which are DEBUG or higher

Inspiration for the syntax is taken from the debugging facilities of the GStreamer multimedia framework.

Class | LogError | Undocumented
Class | Logger | Undocumented
Class | _Logger | Undocumented
Class | ReversedGlobalFilter | It's like a reversed filter, the default behavior
Function | set_log_file | Set the filename used for logging.
Function | set_log_level | Set the log level.
Function | _read_log_levels | Undocumented
Function | _create_console | Undocumented

def set_log_file(filename, mask=None):
Set the filename used for logging.

Parameters | filename |
| mask | optional

def set_log_level(name, level):
Set the log level.

Parameters | name | logging category
| level | level

def _read_log_levels(console_filter):
Undocumented
def _create_console():
Undocumented