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

_ClassType BufferingHandler

Filterer --+    
           |    
     Handler --+
               |
              BufferingHandler
Known Subclasses:

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.

Instance Methods [hide private]
 
__init__(self, capacity)
Initialize the handler with the buffer size.
 
shouldFlush(self, record)
Should the handler flush its buffer?
 
emit(self, record)
Emit a record.
 
flush(self)
Override to implement custom flushing behaviour.
 
close(self)
Close the handler.

Inherited from Handler: acquire, createLock, format, handle, handleError, release, setFormatter, setLevel

Inherited from Filterer: addFilter, filter, removeFilter

Method Details [hide private]

__init__(self, capacity)
(Constructor)

 

Initialize the handler with the buffer size.

Overrides: Filterer.__init__

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.

emit(self, record)

 

Emit a record.

Append the record. If shouldFlush() tells us to, call flush() to process the buffer.

Overrides: Handler.emit

flush(self)

 

Override to implement custom flushing behaviour.

This version just zaps the buffer to empty.

Overrides: Handler.flush

close(self)

 

Close the handler.

This version just flushes and chains to the parent class' close().

Overrides: Handler.close