Handlers have the following attributes and methods. Note that
Handler is never instantiated directly; this class acts as a
base for more useful subclasses. However, the __init__()
method in subclasses needs to call Handler.__init__().
-
Initializes the Handler instance by setting its level, setting
the list of filters to the empty list and creating a lock (using
createLock()) for serializing access to an I/O mechanism.
-
Initializes a thread lock which can be used to serialize access to
underlying I/O functionality which may not be threadsafe.
-
Acquires the thread lock created with createLock().
-
Releases the thread lock acquired with acquire().
-
Sets the threshold for this handler to lvl. Logging messages which are
less severe than lvl will be ignored. When a handler is created, the
level is set to NOTSET (which causes all messages to be processed).
-
Sets the Formatter for this handler to form.
-
Adds the specified filter filt to this handler.
-
Removes the specified filter filt from this handler.
-
Applies this handler's filters to the record and returns a true value if
the record is to be processed.
-
Ensure all logging output has been flushed. This version does
nothing and is intended to be implemented by subclasses.
-
Tidy up any resources used by the handler. This version does
nothing and is intended to be implemented by subclasses.
-
Conditionally emits the specified logging record, depending on
filters which may have been added to the handler. Wraps the actual
emission of the record with acquisition/release of the I/O thread
lock.
-
This method should be called from handlers when an exception is
encountered during an emit() call. By default it does nothing,
which means that exceptions get silently ignored. This is what is
mostly wanted for a logging system - most users will not care
about errors in the logging system, they are more interested in
application errors. You could, however, replace this with a custom
handler if you wish. The specified record is the one which was being
processed when the exception occurred.
-
Do formatting for a record - if a formatter is set, use it.
Otherwise, use the default formatter for the module.
-
Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so
raises a NotImplementedError.
Release 2.5, documentation updated on 19th September, 2006.
See About this document... for information on suggesting changes.