From 282a11ef2f52cf91464c1de056ac56b0a3a4c436 Mon Sep 17 00:00:00 2001 From: Joseph Banks Date: Fri, 21 Feb 2020 22:48:20 +0000 Subject: Enable logging warnings to Sentry --- bot/__init__.py | 4 ++-- bot/__main__.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bot/__init__.py b/bot/__init__.py index 923ef517b..90ab3c348 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -40,6 +40,6 @@ root_log.setLevel(TRACE_LEVEL if DEBUG_MODE else logging.INFO) root_log.addHandler(stream_handler) root_log.addHandler(file_handler) -logging.getLogger("discord").setLevel(logging.ERROR) -logging.getLogger("websockets").setLevel(logging.ERROR) +logging.getLogger("discord").setLevel(logging.WARNING) +logging.getLogger("websockets").setLevel(logging.WARNING) logging.getLogger(__name__).setLevel(TRACE_LEVEL) diff --git a/bot/__main__.py b/bot/__main__.py index 2ed078903..490163739 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -1,13 +1,22 @@ +import logging + import discord import sentry_sdk from discord.ext.commands import when_mentioned_or +from sentry_sdk.integrations.logging import LoggingIntegration from bot import patches from bot.bot import Bot from bot.constants import Bot as BotConfig, DEBUG_MODE +sentry_logging = LoggingIntegration( + level=logging.TRACE, + event_level=logging.WARNING +) + sentry_sdk.init( - dsn=BotConfig.sentry_dsn + dsn=BotConfig.sentry_dsn, + integrations=[sentry_logging] ) bot = Bot( -- cgit v1.2.3