Permalink
Please sign in to comment.
Browse files
Enable Sentry logging in production environments
Sentry is an application error capture and management service. These changes make it possible to send errors generated in production to Sentry by setting one environment variable, SENTRY_DSN.
- Loading branch information...
Showing
with
23 additions
and 0 deletions.
- +4 −0 h/config.py
- +17 −0 h/sentry.py
- +1 −0 production.ini
- +1 −0 requirements.txt
| @@ -0,0 +1,17 @@ | ||
| from raven.conf import setup_logging | ||
| from raven.handlers.logging import SentryHandler | ||
| def configure_sentry_logger(dsn): | ||
| """ | ||
| Configure the Sentry log handler for the provided DSN. | ||
| """ | ||
| handler = SentryHandler(dsn) | ||
| setup_logging(handler) | ||
| def includeme(config): | ||
| dsn = config.registry.settings.get('sentry.dsn') | ||
| if dsn is not None: | ||
| configure_sentry_logger(dsn) |
0 comments on commit
6bf551c