From eebddd6e89647ef05941fa9857c27bd6221d9f11 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Wed, 5 Jun 2024 00:25:19 -0400 Subject: [PATCH] fix(aurora): override `aiosqlite`'s logging level to warning --- aurora/aurora.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aurora/aurora.py b/aurora/aurora.py index 0b4463a..fed5034 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -6,6 +6,7 @@ # |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_| import json +import logging as py_logging import os import time from datetime import datetime, timedelta, timezone @@ -81,6 +82,12 @@ class Aurora(commands.Cog): self.bot = bot register_config(config) self.handle_expiry.start() + # If we don't override aiosqlite's logging level, it will spam the console with dozens of debug messages per query. + # This is unnecessary because Aurora already logs all of its SQL queries (or at least, most of them), + # and the information that aiosqlite logs is not useful to the bot owner. + # This is a bad solution though as it overrides it for any other cogs that are using aiosqlite too. + # If there's a better solution that you're aware of, please let me know in Discord or in a CoastalCommits issue. + py_logging.getLogger('aiosqlite').setLevel(py_logging.WARNING) def format_help_for_context(self, ctx: commands.Context) -> str: pre_processed = super().format_help_for_context(ctx) or ""