Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.support.TestHandler Class Reference
Inheritance diagram for test.support.TestHandler:
Inheritance graph
[legend]
Collaboration diagram for test.support.TestHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def shouldFlush
def emit
def matches
def shouldFlush
def flush
def close

Public Attributes

 matcher
 capacity
 buffer

Detailed Description

Definition at line 1448 of file support.py.


Constructor & Destructor Documentation

def test.support.TestHandler.__init__ (   self,
  capacity 
)
Initialize the handler with the buffer size.

Reimplemented from logging.handlers.BufferingHandler.

Definition at line 1449 of file support.py.

01449 
01450     def __init__(self, matcher):
01451         # BufferingHandler takes a "capacity" argument
01452         # so as to know when to flush. As we're overriding
01453         # shouldFlush anyway, we can set a capacity of zero.
01454         # You can call flush() manually to clear out the
01455         # buffer.
01456         logging.handlers.BufferingHandler.__init__(self, 0)
01457         self.matcher = matcher

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def logging.handlers.BufferingHandler.close (   self) [inherited]
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 test.support.TestHandler.emit (   self,
  record 
)
Emit a record.

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

Reimplemented from logging.handlers.BufferingHandler.

Definition at line 1461 of file support.py.

01461 
01462     def emit(self, record):
01463         self.format(record)
01464         self.buffer.append(record.__dict__)

Here is the call graph for this function:

def logging.handlers.BufferingHandler.flush (   self) [inherited]
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 test.support.TestHandler.matches (   self,
  kwargs 
)
Look for a saved dict whose keys/values match the supplied arguments.

Definition at line 1465 of file support.py.

01465 
01466     def matches(self, **kwargs):
01467         """
01468         Look for a saved dict whose keys/values match the supplied arguments.
01469         """
01470         result = False
01471         for d in self.buffer:
01472             if self.matcher.matches(d, **kwargs):
01473                 result = True
01474                 break
01475         return result

def logging.handlers.BufferingHandler.shouldFlush (   self,
  record 
) [inherited]
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:

Definition at line 1458 of file support.py.

01458 
01459     def shouldFlush(self):
01460         return False


Member Data Documentation

Reimplemented in logging.handlers.MemoryHandler.

Definition at line 1070 of file handlers.py.

Definition at line 1069 of file handlers.py.

Definition at line 1456 of file support.py.


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