API documentation

The following documentation is based on the source code of version 1.6 of the verboselogs package.

verboselogs

Verbose, notice, and spam log levels for Python’s logging module.

The verboselogs module defines the VERBOSE, NOTICE, and SPAM 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 VERBOSE, NOTICE, and SPAM with Python’s logging module.

verboselogs.NOTICE = 25

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.

See also:The notice() method of the VerboseLogger class.
verboselogs.VERBOSE = 15

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.
verboselogs.SPAM = 5

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.
verboselogs.install()[source]

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
verboselogs.add_log_level(value, name)[source]

Add a new log level to the logging module.

Parameters:
  • value – The log level’s number (an integer).
  • name – The name for the log level (a string).
class verboselogs.VerboseLogger(*args, **kw)[source]

Custom logger class to support the additional logging levels.

This subclass of logging.Logger adds support for the additional logging methods verbose(), notice(), and spam(). You can use install() to make VerboseLogger the default logger class.

notice(msg, *args, **kw)[source]

Log a message with level NOTICE. The arguments are interpreted as for logging.debug().

verbose(msg, *args, **kw)[source]

Log a message with level VERBOSE. The arguments are interpreted as for logging.debug().

spam(msg, *args, **kw)[source]

Log a message with level SPAM. The arguments are interpreted as for logging.debug().

verboselogs.pylint

Pylint plugin to fix invalid errors about the logging module.

verboselogs.pylint.register(linter)[source]

No-op (required by Pylint).

verboselogs.pylint.verboselogs_class_transform(cls)[source]

Make Pylint aware of RootLogger.verbose(), RootLogger.notice(), and RootLogger.spam().

verboselogs.pylint.verboselogs_module_transform(mod)[source]

Make Pylint aware of logging.VERBOSE, logging.notice(), and logging.SPAM.