Skip to content

Commit

Permalink
update from raven to sentry-sdk (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
sljeff authored Sep 28, 2020
1 parent 21efd98 commit 8f35318
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions sea/contrib/extensions/sentry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import raven
from raven.conf import setup_logging
from raven.handlers.logging import SentryHandler
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations import DidNotEnable


class Sentry:
Expand All @@ -10,14 +9,14 @@ def init_app(self, app):
dsn = app.config.get('SENTRY_DSN')
if dsn:
config = app.config.get_namespace('SENTRY_')
self.client = raven.Client(**config)
handler = SentryHandler(self.client)
handler.setLevel(logging.ERROR)
setup_logging(handler)
sentry_logging = LoggingIntegration()
integrations = [sentry_logging]

try:
from raven.contrib.celery import (
register_signal, register_logger_signal)
register_logger_signal(self.client)
register_signal(self.client)
except ImportError:
from sentry_sdk.integrations.celery import CeleryIntegration

integrations.append(CeleryIntegration())
except DidNotEnable:
pass

sentry_sdk.init(**config, integrations=integrations)

0 comments on commit 8f35318

Please sign in to comment.