The following documentation is based on the source code of version 1.7 of the verboselogs package.
Custom log levels for Python’s logging module.
The verboselogs module defines the NOTICE, SPAM, SUCCESS and VERBOSE constants, the VerboseLogger class and the add_log_level() and install() functions.
At import time add_log_level() is used to register the custom log levels NOTICE, SPAM, SUCCESS and VERBOSE with Python’s logging module.
The numeric value of the ‘notice’ log level (a number).
The value of NOTICE positions the notice log level between the WARNING and INFO levels. Refer to pull request #3 for more details.
See also: | The notice() method of the VerboseLogger class. |
---|
The numeric value of the ‘spam’ log level (a number).
The value of SPAM positions the spam log level between the DEBUG and NOTSET levels.
See also: | The spam() method of the VerboseLogger class. |
---|
The numeric value of the ‘success’ log level (a number).
The value of SUCCESS positions the success log level between the WARNING and ERROR levels. Refer to issue #4 for more details.
See also: | The success() method of the VerboseLogger class. |
---|
The numeric value of the ‘verbose’ log level (a number).
The value of VERBOSE positions the verbose log level between the INFO and DEBUG levels.
See also: | The verbose() method of the VerboseLogger class. |
---|
Make VerboseLogger the default logger class.
The install() function uses setLoggerClass() to configure VerboseLogger as the default class for all loggers created by logging.getLogger() after install() has been called. Here’s how it works:
import logging
import verboselogs
verboselogs.install()
logger = logging.getLogger(__name__) # will be a VerboseLogger instance
Add a new log level to the logging module.
Parameters: |
|
---|
Custom logger class to support the additional logging levels.
This subclass of logging.Logger adds support for the additional logging methods notice(), spam(), success() and verbose().
You can use verboselogs.install() to make VerboseLogger the default logger class.
Log a message with level NOTICE. The arguments are interpreted as for logging.debug().
Log a message with level SPAM. The arguments are interpreted as for logging.debug().
Pylint plugin to fix invalid errors about the logging module.