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

Class BufferingHandler

source code

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.
source code
 
shouldFlush(self, record)
Should the handler flush its buffer?
source code
 
emit(self, record)
Emit a record.
source code
 
flush(self)
Override to implement custom flushing behaviour.
source code
 
close(self)
Close the handler.
source code

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)

source code 

Initialize the handler with the buffer size.

Overrides: Filterer.__init__

shouldFlush(self, record)

source code 

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)

source code 

Emit a record.

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

Overrides: Handler.emit

flush(self)

source code 

Override to implement custom flushing behaviour.

This version just zaps the buffer to empty.

Overrides: Handler.flush

close(self)

source code 

Close the handler.

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

Overrides: Handler.close