From 34c16c8cdf00f7c45a19a8ffc4841aec3c2c3895 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 6 Aug 2024 13:47:49 +0300 Subject: [PATCH] logging-sentry --- services/sentry.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/sentry.py b/services/sentry.py index 8873b94a..48fdd8e3 100644 --- a/services/sentry.py +++ b/services/sentry.py @@ -1,10 +1,16 @@ import sentry_sdk +import logging from sentry_sdk.integrations.ariadne import AriadneIntegration from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration from sentry_sdk.integrations.starlette import StarletteIntegration - +from sentry_sdk.integrations.logging import LoggingIntegration from settings import GLITCHTIP_DSN +sentry_logging = LoggingIntegration( + level=logging.DEBUG, # Capture info and above as breadcrumbs + event_level=logging.ERROR # Send errors as events +) + def start_sentry(): # sentry monitoring @@ -23,6 +29,7 @@ def start_sentry(): StarletteIntegration(), AriadneIntegration(), SqlalchemyIntegration(), + sentry_logging ], ) except Exception as e: