Skip to main content

Count how many time errors occur

Project description

Compteur

I use Python scripts in crontab. Sometimes, a script crashes, and I receive an email with the error.
But it can be a random crash and I do not need to know it, as it will not crash next time the script is launched.

Goal of this package is to track how many times an error occurs. I can define a limit of # errors before warning me.

Exemple

#!/usr/bin/env python3
from compteur import Compteur

cpt = Compteur('smartname')

try:
    # My wonderful script
except:
    cpt.inc()
    if cpt.isLimit():
        raise
else:
    cpt.reset()
finally:
    # do something

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

compteur-1.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

compteur-1.1-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

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