From eaa573c715c80f47614dfc70e8c2385ffdfbdc74 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 5 Apr 2019 16:11:53 +0200 Subject: [PATCH] fully remove raven and switch WSGI and logging to sentry_sdk --- client-packages/allauth/allauth_passbook/urls.py | 1 + client-packages/allauth/allauth_passbook/views.py | 2 +- passbook/core/celery.py | 2 -- passbook/core/requirements.txt | 1 + passbook/core/settings.py | 12 +++++++----- passbook/core/wsgi.py | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/client-packages/allauth/allauth_passbook/urls.py b/client-packages/allauth/allauth_passbook/urls.py index 0a5bcc1d4..29e09509b 100644 --- a/client-packages/allauth/allauth_passbook/urls.py +++ b/client-packages/allauth/allauth_passbook/urls.py @@ -1,5 +1,6 @@ """passbook provider""" from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns + from allauth_passbook.provider import PassbookProvider urlpatterns = default_urlpatterns(PassbookProvider) diff --git a/client-packages/allauth/allauth_passbook/views.py b/client-packages/allauth/allauth_passbook/views.py index 6c939d552..c79208fe2 100644 --- a/client-packages/allauth/allauth_passbook/views.py +++ b/client-packages/allauth/allauth_passbook/views.py @@ -1,10 +1,10 @@ """passbook adapter""" import requests - from allauth.socialaccount import app_settings from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter, OAuth2CallbackView, OAuth2LoginView) + from allauth_passbook.provider import PassbookProvider diff --git a/passbook/core/celery.py b/passbook/core/celery.py index caba0b676..e1ee4556e 100644 --- a/passbook/core/celery.py +++ b/passbook/core/celery.py @@ -6,8 +6,6 @@ import os from celery import Celery, signals from django.conf import settings -# from raven import Client - # set the default Django settings module for the 'celery' program. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.core.settings") diff --git a/passbook/core/requirements.txt b/passbook/core/requirements.txt index 15bceac21..fd80ba3f1 100644 --- a/passbook/core/requirements.txt +++ b/passbook/core/requirements.txt @@ -11,3 +11,4 @@ markdown psycopg2 PyYAML sentry-sdk +pip diff --git a/passbook/core/settings.py b/passbook/core/settings.py index ca7c8f736..421d9c122 100644 --- a/passbook/core/settings.py +++ b/passbook/core/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/ """ import importlib +import logging import os import sys @@ -19,6 +20,7 @@ from django.contrib import messages from sentry_sdk import init as sentry_init from sentry_sdk.integrations.celery import CeleryIntegration from sentry_sdk.integrations.django import DjangoIntegration +from sentry_sdk.integrations.logging import LoggingIntegration from passbook import __version__ from passbook.lib.config import CONFIG @@ -220,6 +222,10 @@ sentry_init( integrations=[ DjangoIntegration(), CeleryIntegration(), + LoggingIntegration( + level=logging.INFO, + event_level=logging.ERROR + ) ], send_default_pii=True ) @@ -241,7 +247,7 @@ with CONFIG.cd('web'): STATIC_URL = '/static/' -LOG_HANDLERS = ['console', 'syslog', 'file', 'sentry'] +LOG_HANDLERS = ['console', 'syslog', 'file'] with CONFIG.cd('log'): LOGGING = { @@ -272,10 +278,6 @@ with CONFIG.cd('log'): 'class': 'logging.StreamHandler', 'formatter': 'color', }, - 'sentry': { - 'level': 'ERROR', - 'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler', - }, 'syslog': { 'level': CONFIG.get('level').get('file'), 'class': 'logging.handlers.SysLogHandler', diff --git a/passbook/core/wsgi.py b/passbook/core/wsgi.py index a8fc46c23..6ad5ceefd 100644 --- a/passbook/core/wsgi.py +++ b/passbook/core/wsgi.py @@ -10,8 +10,8 @@ https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ import os from django.core.wsgi import get_wsgi_application -from raven.contrib.django.raven_compat.middleware.wsgi import Sentry +from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passbook.settings') -application = Sentry(get_wsgi_application()) +application = SentryWsgiMiddleware(get_wsgi_application())