The MemoryHandler supports buffering of logging records in memory,
periodically flushing them to a target handler. Flushing occurs
whenever the buffer is full, or when an event of a certain severity or
greater is seen.
MemoryHandler is a subclass of the more general
BufferingHandler, which is an abstract class. This buffers logging
records in memory. Whenever each record is added to the buffer, a
check is made by calling shouldFlush() to see if the buffer
should be flushed. If it should, then flush() is expected to
do the needful.
class BufferingHandler( |
capacity) |
-
Initializes the handler with a buffer of the specified capacity.
-
Appends the record to the buffer. If shouldFlush() returns true,
calls flush() to process the buffer.
-
You can override this to implement custom flushing behavior. This version
just zaps the buffer to empty.
-
Returns true if the buffer is up to capacity. This method can be
overridden to implement custom flushing strategies.
class MemoryHandler( |
capacity[, flushLevel
[, target]]) |
-
Returns a new instance of the MemoryHandler class. The
instance is initialized with a buffer size of capacity. If
flushLevel is not specified, ERROR is used. If no
target is specified, the target will need to be set using
setTarget() before this handler does anything useful.
-
Calls flush(), sets the target to None and
clears the buffer.
-
For a MemoryHandler, flushing means just sending the buffered
records to the target, if there is one. Override if you want
different behavior.
-
Sets the target handler for this handler.
-
Checks for buffer full or a record at the flushLevel or higher.
Release 2.3.5, documentation updated on February 8, 2005.
See About this document... for information on suggesting changes.