import logging import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.logging import LoggingIntegration SENTRY_CONFIG = { 'dsn': "https://8b9022772a4e46eb80bee3d16f28fb86@jora.flexites.org/7", 'integrations': [ DjangoIntegration(), LoggingIntegration( level=logging.INFO, # Capture info and above as breadcrumbs event_level=logging.ERROR # Send errors as events ), LoggingIntegration( level=logging.INFO, # Capture info and above as breadcrumbs event_level=logging.WARNING # Send errors as events ) ], 'traces_sample_rate': 1.0, 'send_default_pii': True, 'environment': 'production' } def sentry_start(sentry_config=None): if sentry_config is None: sentry_config = SENTRY_CONFIG return sentry_sdk.init(sentry_config)