logging¶
Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python.
Copyright (C) 2001-2014 Vinay Sajip. All Rights Reserved.
To use, simply ‘import logging’ and log away!
Functions¶
addLevelName(level, levelName) |
Associate ‘levelName’ with ‘level’. |
basicConfig(**kwargs) |
Do basic configuration for the logging system. |
captureWarnings(capture) |
If capture is true, redirect all warnings to the logging package. |
critical(msg, *args, **kwargs) |
Log a message with severity ‘CRITICAL’ on the root logger. |
currentframe() |
|
debug(msg, *args, **kwargs) |
Log a message with severity ‘DEBUG’ on the root logger. |
disable(level) |
Disable all logging calls of severity ‘level’ and below. |
error(msg, *args, **kwargs) |
Log a message with severity ‘ERROR’ on the root logger. |
exception(msg, *args, **kwargs) |
Log a message with severity ‘ERROR’ on the root logger, with exception information. |
fatal(msg, *args, **kwargs) |
Log a message with severity ‘CRITICAL’ on the root logger. |
getLevelName(level) |
Return the textual representation of logging level ‘level’. |
getLogger([name]) |
Return a logger with the specified name, creating it if necessary. |
getLoggerClass() |
Return the class to be used when instantiating a logger. |
info(msg, *args, **kwargs) |
Log a message with severity ‘INFO’ on the root logger. |
log(level, msg, *args, **kwargs) |
Log ‘msg % args’ with the integer severity ‘level’ on the root logger. |
makeLogRecord(dict) |
Make a LogRecord whose attributes are defined by the specified dictionary, This function is useful for converting a logging event received over a socket connection (which is sent as a dictionary) into a LogRecord instance. |
setLoggerClass(klass) |
Set the class to be used when instantiating a logger. |
shutdown([handlerList]) |
Perform any cleanup actions in the logging system (e.g. |
warn(msg, *args, **kwargs) |
Log a message with severity ‘WARNING’ on the root logger. |
warning(msg, *args, **kwargs) |
Log a message with severity ‘WARNING’ on the root logger. |
Classes¶
BufferingFormatter([linefmt]) |
A formatter suitable for formatting a number of records. |
FileHandler(filename[, mode, encoding, delay]) |
A handler class which writes formatted logging records to disk files. |
Filter([name]) |
Filter instances are used to perform arbitrary filtering of LogRecords. |
Filterer() |
A base class for loggers and handlers which allows them to share common code. |
Formatter([fmt, datefmt]) |
Formatter instances are used to convert a LogRecord to text. |
Handler([level]) |
Handler instances dispatch logging events to specific destinations. |
LogRecord(name, level, pathname, lineno, ...) |
A LogRecord instance represents an event being logged. |
Logger(name[, level]) |
Instances of the Logger class represent a single logging channel. |
LoggerAdapter(logger, extra) |
An adapter for loggers which makes it easier to specify contextual information in logging output. |
Manager(rootnode) |
There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers. |
NullHandler([level]) |
This handler does nothing. |
PlaceHolder(alogger) |
PlaceHolder instances are used in the Manager logger hierarchy to take the place of nodes for which no loggers have been defined. |
RootLogger(level) |
A root logger is not that different to any other logger, except that it must have a logging level and there is only one instance of it in the hierarchy. |
StreamHandler([stream]) |
A handler class which writes logging records, appropriately formatted, to a stream. |