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

Class MemoryHandler

source code

Filterer --+        
           |        
     Handler --+    
               |    
BufferingHandler --+
                   |
                  MemoryHandler

A handler class which buffers 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.

Instance Methods [hide private]
 
__init__(self, capacity, flushLevel=40, target=None)
Initialize the handler with the buffer size, the level at which flushing should occur and an optional target.
source code
 
shouldFlush(self, record)
Check for buffer full or a record at the flushLevel or higher.
source code
 
setTarget(self, target)
Set the target handler for this handler.
source code
 
flush(self)
For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one.
source code
 
close(self)
Flush, set the target to None and lose the buffer.
source code

Inherited from BufferingHandler: emit

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

Inherited from Filterer: addFilter, filter, removeFilter

Method Details [hide private]

__init__(self, capacity, flushLevel=40, target=None)
(Constructor)

source code 

Initialize the handler with the buffer size, the level at which flushing should occur and an optional target.

Note that without a target being set either here or via setTarget(), a MemoryHandler is no use to anyone!

Overrides: Filterer.__init__

shouldFlush(self, record)

source code 

Check for buffer full or a record at the flushLevel or higher.

Overrides: BufferingHandler.shouldFlush

flush(self)

source code 

For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. Override if you want different behaviour.

Overrides: Handler.flush

close(self)

source code 

Flush, set the target to None and lose the buffer.

Overrides: Handler.close