errorhandler 1.1.0
A logging framework handler that tracks when messages above a certain level have been logged.
This is a handler for the python standard logging framework that can be used to tell whether messages have been logged at or above a certain level.
This can be useful when wanting to ensure that no errors have been logged before committing data back to a database.
As an example, first, you set up the error handler:
>>> from errorhandler import ErrorHandler >>> e = ErrorHandler()
Then you can log and check the handler at any point to see if it has been triggered:
>>> e.fired
False
>>> from logging import getLogger
>>> logger = getLogger()
>>> logger.error('an error')
>>> e.fired
True
You can use the fired attribute to only perform actions when no errors have been logged:
>>> if e.fired: ... print "Not updating files as errors have occurred" Not updating files as errors have occurred
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| errorhandler-1.1.0.tar.gz (md5) | Source | 2009-11-07 12:52:23.315242 | 8KB | 40 | |
- Author: Chris Withers <chris at simplistix co uk>
- Home Page: http://www.simplistix.co.uk/software/python/errorhandler
- License: MIT
- Categories
- Package Index Owner: chrisw
- DOAP record: errorhandler-1.1.0.xml
Log in to rate this package.
