Skip to content

Commit

Permalink
Upgrade from Raven to Sentry SDK.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyandrewmeyer committed Oct 8, 2018
1 parent 7e1273b commit 617d4da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.0.7 (2018-10-08)

- Upgrade from Raven to Sentry SDK.

### 1.0.6 (2017-03-29)

- Add support for debugging.
Expand Down
2 changes: 1 addition & 1 deletion spoon/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.6"
__version__ = "1.0.7"
30 changes: 9 additions & 21 deletions spoon/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
import logging.handlers

try:
import raven
import raven.transport
from raven.handlers.logging import SentryHandler
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
except ImportError:
_has_raven = False
_has_sentry = False
else:
_has_raven = True
_has_sentry = True


def detach(stdout="/dev/null", stderr=None, stdin="/dev/null",
Expand Down Expand Up @@ -138,22 +137,11 @@ def _setup_logging(logger, options):
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)

if options["sentry_dsn"] and _has_raven:
client = raven.Client(options["sentry_dsn"],
enable_breadcrumbs=False,
transport=raven.transport.HTTPTransport)

# Add Sentry handle to application logger.
sentry_handler = SentryHandler(client)
sentry_handler.setLevel(logging.WARNING)
logger.addHandler(sentry_handler)

null_loggers = [
logging.getLogger("sentry.errors"),
logging.getLogger("sentry.errors.uncaught")
]
for null_logger in null_loggers:
null_logger.handlers = [logging.NullHandler()]
if options["sentry_dsn"] and _has_sentry:
sentry_sdk.init(
dsn=options["sentry_dsn"],
integrations=[FlaskIntegration()]
)

if options["debug"]:
stream_handler.setLevel(logging.DEBUG)
Expand Down

0 comments on commit 617d4da

Please sign in to comment.