=============
Error Tracker
=============
**Full featured error tracking module for Python apps supports Flask and Django**
.. image:: https://img.shields.io/pypi/v/error-tracker.svg?color=dark-green
:target: https://pypi.org/project/error-tracker
.. image:: https://img.shields.io/pypi/pyversions/error-tracker.svg?color=dark-green
:target: https://pypi.org/project/error-tracker
.. image:: https://img.shields.io/github/license/sonus21/error-tracker.svg?color=dark-green
:target: https://github.com/sonus21/error-tracker/blob/master/LICENSE.txt
.. image:: https://travis-ci.org/sonus21/error-tracker.svg?branch=master
:target: https://travis-ci.org/sonus21/error-tracker
.. image:: https://coveralls.io/repos/github/sonus21/error-tracker/badge.svg?color=dark-green
:target: https://coveralls.io/github/sonus21/error-tracker
Introduction
------------
ErrorTracker is a batteries-included app and extensions for python app, that can track errors, send notification, mask sensitive data and capture frames data.
It plays nicely with `Django <https://www.djangoproject.com/>`_ and `Flask <http://flask.pocoo.org/>`_
Simple to use extension that lets you add error recording interfaces to Python applications.
It's implemented in such a way that the developer has total control of the resulting application.
Out-of-the-box, Error Tracker plays nicely with various ORM's, including
- `SQLAlchemy <http://www.sqlalchemy.org/>`_,
- `MongoEngine <http://mongoengine.org/>`_,
- `Django ORM <https://tutorial.djangogirls.org/en/django_orm/>`_
It also boasts a simple Model management interface.
The biggest feature of ErrorTracker is flexibility. To start off with you can create a very simple application in no time,
with exception monitor enabled, but then you can go further and customize different aspects.
ErrorTracker is an active project, well-tested and production ready.
Installation
------------
To install ErrorTracker, simply::
pip install error-tracker
Features
--------
- Sensitive data( like *password*, *secret* ) Masking
- Record all the frames ( frame data are stored in JSON format so that it can be analyzed later)
- Unique URL generation
- Number of times the exception occurred and first/last time of exception
- Sending notifications with exception details
- Record different types of exception like 500 or 404 etc
- Raise or update ticket in Jira/Bugzilla etc by ticketing interface.
Usage
-----
Flask App configuration
=======================
.. code::
...
APP_ERROR_SEND_EMAIL = True
APP_ERROR_RECIPIENT_EMAIL = ('example@example.com',)
APP_ERROR_SUBJECT_PREFIX = "Server Error"
APP_ERROR_EMAIL_SENDER = 'user@example.com'
app.py
.. code::
from flask import Flask
from flask_mail import Mail
import settings
from error_tracker import AppErrorTracker, NotificationMixin
from flask_sqlalchemy import SQLAlchemy
...
app = Flask(__name__)
app.config.from_object(settings)
db = SQLAlchemy(app)
class Notifier(Mail, NotificationMixin):
def notify(self, request, exception,
email_subject=None,
email_body=None,
from_email=None,
recipient_list=None):
message = Message(email_subject, recipient_list, email_body, sender=from_email)
self.send(message)
mailer = Notifier(app=app)
error_tracker = AppErrorTracker(app=app, db=db, notifier=mailer)
....
....
# Record exception when 404 error code is raised
@app.errorhandler(403)
def error_403(e):
error_tracker.capture_exception()
# any custom logic
# Record error using decorator
@app.errorhandler(500)
@error_tracker.track_exception
def error_500(e):
# some custom logic
....
Django App Usage
================
We need to update settings.py file as
- Add app to installed apps list
- Add Middleware for exception tracking. This should be added at the end so that it can process exception 1st in the middleware call stack.
- Other configs related to notification
Sample Code
.. code::
...
APP_ERROR_RECIPIENT_EMAIL = ('example@example.com',)
APP_ERROR_SUBJECT_PREFIX = "Server Error"
APP_ERROR_EMAIL_SENDER = 'user@example.com'
INSTALLED_APPS = [
...
'error_tracker.DjangoErrorTracker'
]
MIDDLEWARE = [
...
'error_tracker.django.middleware.ExceptionTrackerMiddleWare'
]
Documentations
--------------
This has got extensive document browse at https://error-tracker.readthedocs.io/en/latest/
All docs are in `docs/source`
And if you want to preview any *.rst* snippets that you may want to contribute, go to `http://rst.ninjs.org/ <http://rst.ninjs.org/>`_.
Examples
--------
Several usage examples are included in the */tests* folder. Please feel free to add your own examples, or improve
on some of the existing ones, and then submit them via GitHub as a *pull-request*.
You can see some of these examples in action at https://github.com/sonus21/error-tracker/tree/master/examples
To run the examples on your local environment, one at a time, do something like::
cd error-tracker/examples
Django::
cd error-tracker/examples
cd DjangoSample
python manage.py runserver
Flask::
cd flask-sample
python app.py
Tests
-----
To run the tests, from the project directory, simply::
pip install -r requirements-dev.txt
bash run-tests.sh
You should see output similar to::
.............................................
----------------------------------------------------------------------
Ran 31 tests in 1.144s
OK
Contribution
-------------
You're most welcome to raise pull request or fixes.
Raw data
{
"_id": null,
"home_page": "https://github.com/sonus21/error-tracker/",
"name": "error-tracker",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"maintainer_email": "",
"keywords": "Flask,error-tracker,exception-tracking,exception-monitoring,Django",
"author": "Sonu Kumar",
"author_email": "sonunitw12@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/43/75/86bc90a9f27039b6c5d11531676e898c673be0bbc6160189c61103b57146/error-tracker-3.1.1.tar.gz",
"platform": "any",
"description": "=============\nError Tracker\n=============\n\n**Full featured error tracking module for Python apps supports Flask and Django**\n\n.. image:: https://img.shields.io/pypi/v/error-tracker.svg?color=dark-green\n :target: https://pypi.org/project/error-tracker\n\n.. image:: https://img.shields.io/pypi/pyversions/error-tracker.svg?color=dark-green\n :target: https://pypi.org/project/error-tracker\n\n.. image:: https://img.shields.io/github/license/sonus21/error-tracker.svg?color=dark-green\n :target: https://github.com/sonus21/error-tracker/blob/master/LICENSE.txt\n\n.. image:: https://travis-ci.org/sonus21/error-tracker.svg?branch=master\n :target: https://travis-ci.org/sonus21/error-tracker\n\n.. image:: https://coveralls.io/repos/github/sonus21/error-tracker/badge.svg?color=dark-green\n :target: https://coveralls.io/github/sonus21/error-tracker\n\nIntroduction\n------------\nErrorTracker is a batteries-included app and extensions for python app, that can track errors, send notification, mask sensitive data and capture frames data.\n\nIt plays nicely with `Django <https://www.djangoproject.com/>`_ and `Flask <http://flask.pocoo.org/>`_\n\nSimple to use extension that lets you add error recording interfaces to Python applications.\nIt's implemented in such a way that the developer has total control of the resulting application.\n\nOut-of-the-box, Error Tracker plays nicely with various ORM's, including\n\n- `SQLAlchemy <http://www.sqlalchemy.org/>`_,\n- `MongoEngine <http://mongoengine.org/>`_,\n- `Django ORM <https://tutorial.djangogirls.org/en/django_orm/>`_\n\n\nIt also boasts a simple Model management interface.\n\nThe biggest feature of ErrorTracker is flexibility. To start off with you can create a very simple application in no time,\nwith exception monitor enabled, but then you can go further and customize different aspects.\n\nErrorTracker is an active project, well-tested and production ready.\n\nInstallation\n------------\nTo install ErrorTracker, simply::\n\n pip install error-tracker\n\n\nFeatures\n--------\n- Sensitive data( like *password*, *secret* ) Masking\n- Record all the frames ( frame data are stored in JSON format so that it can be analyzed later)\n- Unique URL generation\n- Number of times the exception occurred and first/last time of exception\n- Sending notifications with exception details\n- Record different types of exception like 500 or 404 etc\n- Raise or update ticket in Jira/Bugzilla etc by ticketing interface.\n\nUsage\n-----\n\nFlask App configuration\n=======================\n\n.. code::\n\n ...\n APP_ERROR_SEND_EMAIL = True\n APP_ERROR_RECIPIENT_EMAIL = ('example@example.com',)\n APP_ERROR_SUBJECT_PREFIX = \"Server Error\"\n APP_ERROR_EMAIL_SENDER = 'user@example.com'\n\n\n\napp.py\n\n.. code::\n\n from flask import Flask\n from flask_mail import Mail\n import settings\n from error_tracker import AppErrorTracker, NotificationMixin\n from flask_sqlalchemy import SQLAlchemy\n ...\n app = Flask(__name__)\n app.config.from_object(settings)\n db = SQLAlchemy(app)\n class Notifier(Mail, NotificationMixin):\n def notify(self, request, exception,\n email_subject=None,\n email_body=None,\n from_email=None,\n recipient_list=None):\n message = Message(email_subject, recipient_list, email_body, sender=from_email)\n self.send(message)\n mailer = Notifier(app=app)\n error_tracker = AppErrorTracker(app=app, db=db, notifier=mailer)\n\n ....\n\n ....\n # Record exception when 404 error code is raised\n @app.errorhandler(403)\n def error_403(e):\n error_tracker.capture_exception()\n # any custom logic\n\n # Record error using decorator\n @app.errorhandler(500)\n @error_tracker.track_exception\n def error_500(e):\n # some custom logic\n ....\n\n\nDjango App Usage\n================\n\nWe need to update settings.py file as\n\n- Add app to installed apps list\n- Add Middleware for exception tracking. This should be added at the end so that it can process exception 1st in the middleware call stack.\n- Other configs related to notification\n\nSample Code\n\n\n.. code::\n\n ...\n APP_ERROR_RECIPIENT_EMAIL = ('example@example.com',)\n APP_ERROR_SUBJECT_PREFIX = \"Server Error\"\n APP_ERROR_EMAIL_SENDER = 'user@example.com'\n\n INSTALLED_APPS = [\n ...\n 'error_tracker.DjangoErrorTracker'\n ]\n MIDDLEWARE = [\n ...\n 'error_tracker.django.middleware.ExceptionTrackerMiddleWare'\n ]\n\n\nDocumentations\n--------------\nThis has got extensive document browse at https://error-tracker.readthedocs.io/en/latest/\n\nAll docs are in `docs/source`\n\nAnd if you want to preview any *.rst* snippets that you may want to contribute, go to `http://rst.ninjs.org/ <http://rst.ninjs.org/>`_.\n\n\nExamples\n--------\nSeveral usage examples are included in the */tests* folder. Please feel free to add your own examples, or improve\non some of the existing ones, and then submit them via GitHub as a *pull-request*.\n\nYou can see some of these examples in action at https://github.com/sonus21/error-tracker/tree/master/examples\nTo run the examples on your local environment, one at a time, do something like::\n\n cd error-tracker/examples\n\n\nDjango::\n\n cd error-tracker/examples\n cd DjangoSample\n python manage.py runserver\n\nFlask::\n\n cd flask-sample\n python app.py\n\n\nTests\n-----\nTo run the tests, from the project directory, simply::\n\n pip install -r requirements-dev.txt\n bash run-tests.sh\n\nYou should see output similar to::\n\n .............................................\n ----------------------------------------------------------------------\n Ran 31 tests in 1.144s\n\n OK\n\n\nContribution\n-------------\nYou're most welcome to raise pull request or fixes.\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Simple and Extensible Error Monitoring/Tracking framework for Python",
"version": "3.1.1",
"project_urls": {
"Homepage": "https://github.com/sonus21/error-tracker/"
},
"split_keywords": [
"flask",
"error-tracker",
"exception-tracking",
"exception-monitoring",
"django"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "437586bc90a9f27039b6c5d11531676e898c673be0bbc6160189c61103b57146",
"md5": "2a1dc1a2118c94f6d593139208b8fd39",
"sha256": "7f0736183441f99ede82f94eb100f39065068ae83bf8255ac5e4828a2ea64542"
},
"downloads": -1,
"filename": "error-tracker-3.1.1.tar.gz",
"has_sig": false,
"md5_digest": "2a1dc1a2118c94f6d593139208b8fd39",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 29720,
"upload_time": "2023-07-17T17:52:29",
"upload_time_iso_8601": "2023-07-17T17:52:29.458875Z",
"url": "https://files.pythonhosted.org/packages/43/75/86bc90a9f27039b6c5d11531676e898c673be0bbc6160189c61103b57146/error-tracker-3.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-17 17:52:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sonus21",
"github_project": "error-tracker",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"lcname": "error-tracker"
}