Package zope :: Package testing :: Module loghandler :: Class Handler
[show private | hide private]
[frames | no frames]

Class Handler

Filterer --+    
           |    
     Handler --+
               |
              Handler


Handler for use with unittest.TestCase objects.

The handler takes a TestCase instance as a constructor argument. It can be registered with one or more loggers and collects log records they generate.

The assertLogsMessage() and failIfLogsMessage() methods can be used to check the logger output and causes the test to fail as appropriate.
Method Summary
  __init__(self, testcase, propagate)
  add(self, name)
Add handler to logger named name.
  assertLogsMessage(self, msg, level)
  close(self)
Remove handler from any loggers it was added to.
  emit(self, record)
Do whatever it takes to actually log the specified logging record.
  failIfLogsMessage(self, msg)
    Inherited from Handler
  acquire(self)
Acquire the I/O thread lock.
  createLock(self)
Acquire a thread lock for serializing access to the underlying I/O.
  flush(self)
Ensure all logging output has been flushed.
  format(self, record)
Format the specified record.
  handle(self, record)
Conditionally emit the specified logging record.
  handleError(self, record)
Handle errors which occur during an emit() call.
  release(self)
Release the I/O thread lock.
  setFormatter(self, fmt)
Set the formatter for this handler.
  setLevel(self, level)
Set the logging level of this handler.
    Inherited from Filterer
  addFilter(self, filter)
Add the specified filter to this handler.
  filter(self, record)
Determine if a record is loggable by consulting all the filters.
  removeFilter(self, filter)
Remove the specified filter from this handler.

Method Details

add(self, name)

Add handler to logger named name.

close(self)

Remove handler from any loggers it was added to.
Overrides:
logging.Handler.close

emit(self, record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.
Overrides:
logging.Handler.emit (inherited documentation)

Generated by Epydoc 2.1 on Fri Jun 24 12:01:26 2005 http://epydoc.sf.net