fix(aurora): override aiosqlite's logging level to warning

This commit is contained in:
Seaswimmer 2024-06-05 00:25:19 -04:00
parent 5cbf4e7e47
commit eebddd6e89
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -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 ""