Projet

Général

Profil

« Précédent | Suivant » 

Révision e66e0f6a

Ajouté par Jérôme Schneider il y a presque 10 ans

add raven support only for exception

Fixes #3889

Voir les différences:

mandaye/global_config.py
43 43
# Skel root
44 44
skel_root = os.path.join(_PROJECT_PATH, 'mandaye/skel')
45 45

  
46
# Raven Sentry configuration
47
raven_dsn = None
48

  
46 49
# Email notification configuration
47 50
email_notification = False
48 51
email_prefix='[Mandaye]'
mandaye/log.py
5 5

  
6 6
from mandaye import config
7 7

  
8
logger = logging.getLogger('mandaye')
8
logger = logging.getLogger(__name__)
9 9
logger.setLevel(config.log_level)
10 10

  
11 11
# Syslog logging
mandaye/server.py
78 78
    def __init__(self):
79 79
        self.env = None
80 80
        self.dispatcher = None
81
        self.raven_client = None
82
        if config.raven_dsn:
83
            from raven import Client
84
            self.raven_client = Client(config.raven_dsn)
81 85

  
82 86
    def __call__(self, env, start_response):
83 87
        """ called by the WSGI server
......
136 140
            sql_session.commit()
137 141
        except Exception, e:
138 142
            sql_session.rollback()
143
            if self.raven_client:
144
                self.raven_client.captureException()
139 145
            response = self.on_response(start_response, _500(env['PATH_INFO'], "Unhandled exception",
140 146
                exception=e, env=env))
141 147
        finally:
mandaye/skel/example.module/config.py
35 35
# Data dir
36 36
data_dir = os.path.join(_PROJECT_PATH, 'data')
37 37

  
38
# Raven Sentry configuration
39
raven_dsn = None
40

  
38 41
# Email notification configuration
39 42
email_notification = False
40 43
email_prefix = '[Mandaye {project_name}]'

Formats disponibles : Unified diff