Skip to content

Commit 3e651e7

Browse files
committed
Added sentry to docs
1 parent 8d7e7aa commit 3e651e7

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/errorhandling.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,46 @@ exception to the :attr:`~flask.Flask.logger`.
2828
But there is more you can do, and we will cover some better setups to deal
2929
with errors.
3030

31+
Error Logging Tools
32+
-------------------
33+
34+
Sending error mails, even if just for critical ones, can become
35+
overwhelming if enough users are hitting the error and log files are
36+
typically never looked at. This is why we're recommending using
37+
`Sentry <http://www.getsentry.com/>`_ for dealing with application errors.
38+
It's available as an Open Source project `on GitHub
39+
<github.com/getsentry/sentry>`__ and is also available as `Hosted Version
40+
<https://getsentry.com/signup/>`_ which you can try for free. Sentry
41+
aggregates duplicate erorrs, captures the full stack trace and local
42+
variables for debugging, and send you mails based on new errors or
43+
frequency thresholds.
44+
45+
To use Sentry you need to install the `raven` client::
46+
47+
$ pip install raven
48+
49+
And then add this to your Flask app::
50+
51+
from raven.contrib.flask import Sentry
52+
sentry = Sentry(app, dsn='YOUR_DSN_HERE')
53+
54+
Of if you are using factories you can also init it later::
55+
56+
from raven.contrib.flask import Sentry
57+
sentry = Sentry(dsn='YOUR_DSN_HERE')
58+
59+
def create_app():
60+
app = Flask(__name__)
61+
sentry.init_app(app)
62+
...
63+
return app
64+
65+
The `YOUR_DSN_HERE` value needs to be replaced with the DSN value you get
66+
from your Sentry installation.
67+
68+
Afterwards failures are automatically reported to Sentry and from there
69+
you can receive error notifications.
70+
3171
.. _error-handlers:
3272

3373
Error handlers

0 commit comments

Comments
 (0)