diff options
| author | 2024-02-14 00:43:06 +0100 | |
|---|---|---|
| committer | 2024-02-14 10:12:52 +0100 | |
| commit | 4adb57499383e4835848bd5f2c792088ebcf6e74 (patch) | |
| tree | 31c1cdf82ceda496cf33d4111590d8a336bb1972 /arthur/log.py | |
| parent | move logger to its own package (diff) | |
setup the sentry integration upon bot startup
Diffstat (limited to 'arthur/log.py')
| -rw-r--r-- | arthur/log.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arthur/log.py b/arthur/log.py index cfc6c62..c382479 100644 --- a/arthur/log.py +++ b/arthur/log.py @@ -1,6 +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, + ) |