Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
logging.handlers.BufferingHandler Class Reference
Inheritance diagram for logging.handlers.BufferingHandler:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def shouldFlush
def emit
def flush
def close

Public Attributes

 capacity
 buffer

Detailed Description

  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.

Definition at line 1058 of file handlers.py.


Constructor & Destructor Documentation

def logging.handlers.BufferingHandler.__init__ (   self,
  capacity 
)
Initialize the handler with the buffer size.

Reimplemented in test.support.TestHandler.

Definition at line 1064 of file handlers.py.

01064 
01065     def __init__(self, capacity):
01066         """
01067         Initialize the handler with the buffer size.
01068         """
01069         logging.Handler.__init__(self)
01070         self.capacity = capacity
01071         self.buffer = []

Here is the caller graph for this function:


Member Function Documentation

Close the handler.

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

Reimplemented in logging.handlers.MemoryHandler.

Definition at line 1100 of file handlers.py.

01100 
01101     def close(self):
01102         """
01103         Close the handler.
01104 
01105         This version just flushes and chains to the parent class' close().
01106         """
01107         self.flush()
01108         logging.Handler.close(self)

Here is the call graph for this function:

Here is the caller graph for this function:

def logging.handlers.BufferingHandler.emit (   self,
  record 
)
Emit a record.

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

Reimplemented in test.support.TestHandler.

Definition at line 1081 of file handlers.py.

01081 
01082     def emit(self, record):
01083         """
01084         Emit a record.
01085 
01086         Append the record. If shouldFlush() tells us to, call flush() to process
01087         the buffer.
01088         """
01089         self.buffer.append(record)
01090         if self.shouldFlush(record):
01091             self.flush()

Here is the call graph for this function:

Override to implement custom flushing behaviour.

This version just zaps the buffer to empty.

Reimplemented in logging.handlers.MemoryHandler.

Definition at line 1092 of file handlers.py.

01092 
01093     def flush(self):
01094         """
01095         Override to implement custom flushing behaviour.
01096 
01097         This version just zaps the buffer to empty.
01098         """
01099         self.buffer = []

Here is the caller graph for this function:

def logging.handlers.BufferingHandler.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.

Reimplemented in logging.handlers.MemoryHandler.

Definition at line 1072 of file handlers.py.

01072 
01073     def shouldFlush(self, record):
01074         """
01075         Should the handler flush its buffer?
01076 
01077         Returns true if the buffer is up to capacity. This method can be
01078         overridden to implement custom flushing strategies.
01079         """
01080         return (len(self.buffer) >= self.capacity)

Here is the caller graph for this function:


Member Data Documentation

Reimplemented in logging.handlers.MemoryHandler.

Definition at line 1070 of file handlers.py.

Definition at line 1069 of file handlers.py.


The documentation for this class was generated from the following file: