diff options
author | 2024-02-14 09:17:02 +0000 | |
---|---|---|
committer | 2024-02-14 09:17:02 +0000 | |
commit | 6d5ba1374d925100bf850dc5c4a6a99fd03c20e9 (patch) | |
tree | 85bed8ad6d7e7d881c2568181df54d95b11601eb /arthur/log.py | |
parent | Correct typos in Grafana API wrapper doc strings (diff) | |
parent | add a sentry release workflow (diff) |
Merge pull request #149 from python-discord/integrate-sentry
Integrate sentry into king arthur
Diffstat (limited to 'arthur/log.py')
-rw-r--r-- | arthur/log.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arthur/log.py b/arthur/log.py new file mode 100644 index 0000000..c382479 --- /dev/null +++ b/arthur/log.py @@ -0,0 +1,27 @@ +from functools import partial + +import loguru +import sentry_sdk +from sentry_sdk.integrations.loguru import LoggingLevels, LoguruIntegration + +from arthur.config import CONFIG, GIT_SHA + +logger = loguru.logger.opt(colors=True) +logger.opt = partial(logger.opt, colors=True) + + +def setup_sentry() -> None: + """Set up the Sentry logging integrations.""" + loguru_integration = LoguruIntegration( + level=LoggingLevels.DEBUG.value, event_level=LoggingLevels.WARNING.value + ) + + sentry_sdk.init( + dsn=CONFIG.sentry_dsn, + integrations=[ + loguru_integration, + ], + release=f"king-arthur@{GIT_SHA}", + traces_sample_rate=0.5, + profiles_sample_rate=0.5, + ) |