Skip to main content

A logging framework handler that tracks when messages above a certain level have been logged.

Project description

Travis Coveralls Docs PyPI

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.

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

Installation

Do the following in your virtualenv:

pip install errorhandler

Documentation

The latest documentation can also be found at: http://errorhandler.readthedocs.org/en/latest/

Licensing

Copyright (c) 2008-2015 Simplistix Ltd, 2016 Chris Withers. See docs/license.txt for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

errorhandler-2.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

errorhandler-2.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file errorhandler-2.0.0.tar.gz.

File metadata

  • Download URL: errorhandler-2.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for errorhandler-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5968091a2595fcff112e0ac22940e9930716311727efc9e7f0ee6b9849d04a01
MD5 976c960cd0ccdc2fb24faa415f24d1b2
BLAKE2b-256 7cdf6d2ff092864c297bc2755ded73077b5589a7afb20a72e4b4d9de732e7636

See more details on using hashes here.

File details

Details for the file errorhandler-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for errorhandler-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1138c583436886d597cca41648229707abc60f42d405ee641939d039401a2a2f
MD5 ee7909c32ec28b8c3559a1841a0dea5e
BLAKE2b-256 768e80a74a719a503420abe3151a52f6053eb10447f240348d20245c8626d504

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page