aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/log.py
diff options
context:
space:
mode:
Diffstat (limited to 'arthur/log.py')
-rw-r--r--arthur/log.py27
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,
+ )