Package logging :: Module handlers :: Class BufferingHandler
[show private | hide private]
[frames | no frames]

Class BufferingHandler

Filterer --+    
           |    
     Handler --+
               |
              BufferingHandler

Known Subclasses:
LevelHandler

A handler class which buffers logging records in memory. Whenever each record is added to the buffer, a check is made to see if the buffer should be flushed. If it should, then flush() is expected to do what's needed.
Method Summary
  __init__(self, capacity)
Initialize the handler with the buffer size.
  emit(self, record)
Emit a record.
  flush(self)
Override to implement custom flushing behaviour.
  shouldFlush(self, record)
Should the handler flush its buffer?
    Inherited from Handler
  acquire(self)
Acquire the I/O thread lock.
  close(self)
Tidy up any resources used by the handler.
  createLock(self)
Acquire a thread lock for serializing access to the underlying I/O.
  format(self, record)
Format the specified record.
  handle(self, record)
Conditionally emit the specified logging record.
  handleError(self, record)
Handle errors which occur during an emit() call.
  release(self)
Release the I/O thread lock.
  setFormatter(self, fmt)
Set the formatter for this handler.
  setLevel(self, level)
Set the logging level of this handler.
    Inherited from Filterer
  addFilter(self, filter)
Add the specified filter to this handler.
  filter(self, record)
Determine if a record is loggable by consulting all the filters.
  removeFilter(self, filter)
Remove the specified filter from this handler.

Method Details

__init__(self, capacity)
(Constructor)

Initialize the handler with the buffer size.
Overrides:
logging.Handler.__init__

emit(self, record)

Emit a record.

Append the record. If shouldFlush() tells us to, call flush() to process the buffer.
Overrides:
logging.Handler.emit

flush(self)

Override to implement custom flushing behaviour.

This version just zaps the buffer to empty.
Overrides:
logging.Handler.flush

shouldFlush(self, record)

Should the handler flush its buffer?

Returns true if the buffer is up to capacity. This method can be overridden to implement custom flushing strategies.

Generated by Epydoc 2.1 on Thu Apr 14 16:39:26 2005 http://epydoc.sf.net