Mercurial > kallithea
comparison rhodecode/lib/middleware/sentry.py @ 2939:dbe3cfb81446 beta
Added Errormator and Sentry support part of pull request #71
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 18 Oct 2012 23:54:46 +0200 |
parents | |
children | 9937afa7f093 |
comparison
equal
deleted
inserted
replaced
2938:0497d9d9e0c8 | 2939:dbe3cfb81446 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 """ | |
3 rhodecode.lib.middleware.sentry | |
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | |
6 middleware to handle sentry/raven publishing of errors | |
7 | |
8 :created_on: September 18, 2012 | |
9 :author: marcink | |
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> | |
11 :license: GPLv3, see COPYING for more details. | |
12 """ | |
13 # This program is free software: you can redistribute it and/or modify | |
14 # it under the terms of the GNU General Public License as published by | |
15 # the Free Software Foundation, either version 3 of the License, or | |
16 # (at your option) any later version. | |
17 # | |
18 # This program is distributed in the hope that it will be useful, | |
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 # GNU General Public License for more details. | |
22 # | |
23 # You should have received a copy of the GNU General Public License | |
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 | |
26 try: | |
27 from raven.base import Client | |
28 from raven.contrib.pylons import list_from_setting | |
29 from raven.middleware import Sentry as Middleware | |
30 except ImportError: | |
31 Sentry = None | |
32 else: | |
33 class Sentry(Middleware): | |
34 def __init__(self, app, config, client_cls=Client): | |
35 client = client_cls( | |
36 dsn=config.get('sentry.dsn'), | |
37 servers=list_from_setting(config, 'sentry.servers'), | |
38 name=config.get('sentry.name'), | |
39 key=config.get('sentry.key'), | |
40 public_key=config.get('sentry.public_key'), | |
41 secret_key=config.get('sentry.secret_key'), | |
42 project=config.get('sentry.project'), | |
43 site=config.get('sentry.site'), | |
44 include_paths=list_from_setting(config, 'sentry.include_paths'), | |
45 exclude_paths=list_from_setting(config, 'sentry.exclude_paths'), | |
46 ) | |
47 super(Sentry, self).__init__(app, client) |