PyDocs

Nav

Generic Operating System Services

Logger

logging

class (source)
  • Logger(name, level=0)
Instances of the Logger class represent a single logging channel. A
"logging channel" indicates an area of an application. Exactly how an
"area" is defined is up to the application developer. Since an
application can have any number of areas, logging channels are identified
by a unique string. Application areas can be nested (e.g. an area
of "input processing" might include sub-areas "read CSV files", "read
XLS files" and "read Gnumeric files"). To cater for this natural nesting,
channel names are organized into a namespace hierarchy where levels are
separated by periods, much like the Java or Python package namespace. So
in the instance given above, channel names might be "input" for the upper
level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
There is no arbitrary limit to the depth of nesting.
Changed in 3.7
  • 3.7: Loggers can now be pickled and unpickled.
Members of Logger

a

addFilter
Add the specified filter to this handler.
addHandler
Add the specified handler to this logger.

c

critical
Log 'msg % args' with severity 'CRITICAL'.

d

debug
Log 'msg % args' with severity 'DEBUG'.
disabled
This attribute disables handling of any events.

e

error
Log 'msg % args' with severity 'ERROR'.
exception
Convenience method for logging an ERROR with exception information.

f

filter
Determine if a record is loggable by consulting all the filters.
findCaller
Find the stack frame of the caller so that we can note the source file name, line number and function name.

g

getChild
Get a logger which is a descendant to this one.
getChildren
Returns a set of loggers which are immediate children of this logger.
getEffectiveLevel
Get the effective level for this logger.

h

handle
Call the handlers for the specified record.
handlers
The list of handlers directly attached to this logger instance.
hasHandlers
See if this logger has any handlers configured.

i

info
Log 'msg % args' with severity 'INFO'.
isEnabledFor
Is this logger enabled for level 'level'?

l

level
The threshold of this logger, as set by the setLevel() method.
log
Log 'msg % args' with the integer severity 'level'.

m

makeRecord
A factory method which can be overridden in subclasses to create specialized LogRecords.

n

name
This is the logger’s name, and is the value that was passed to getLogger() to obtain the logger.

p

parent
The parent logger of this logger.
propagate
If this attribute evaluates to true, events logged to this logger will be passed to the handlers of higher level (ancestor) loggers, in addition to any handlers attached to this logger.

r

removeFilter
Remove the specified filter from this handler.
removeHandler
Remove the specified handler from this logger.

s

setLevel
Set the logging level of this logger.

w

warning
Log 'msg % args' with severity 'WARNING'.
0 Examples
No examples for logging/Logger.
See Also
No see-alsos for logging/Logger
0 Notes
No notes for Logger