ErrorHandler 1.0.0 Released!

C

Chris Withers

I'm pleased to finally get around to announcing the release of ErrorHandler.

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.

Here's an example:

First, you set up the error handler:

The handler started off being un-fired:
False

Then you do whatever else you need to do, which may involve logging:
False

However, if any logging occurs at an error level or above:

Then the error handler becomes fired:
True

You use this as a condition to only do certain actions when no errors
have been logged:
.... print "Not updating files as errors have occurred"
Not updating files as errors have occurred

If your code does work in batches, you may wish to reset the error
handler at the start of each batch:
False

For more information, please see:
http://www.simplistix.co.uk/software/python/errorhandler
or
http://pypi.python.org/pypi/errorhandler

cheers,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top