The MemoryHandler class, located in the
logging.handlers module, 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.
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.
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
Sets the target handler for this handler.
Checks for buffer full or a record at the flushLevel or higher.
See About this document... for information on suggesting changes.