From 625579ebbb836f9d2409b24e0d829f68d027ee2a Mon Sep 17 00:00:00 2001 From: Michal Tuszowski Date: Fri, 31 Jan 2025 19:49:01 +0100 Subject: [PATCH] another attempt to fix the bug --- thin_client.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/thin_client.py b/thin_client.py index e40dffe..d10aef2 100644 --- a/thin_client.py +++ b/thin_client.py @@ -18,6 +18,18 @@ from discord.ext import commands from communication_subroutine import comm_subroutine from constants import ENCODING, LOGFILE, TOKEN +logger = logging.getLogger("discord") +logger.setLevel(logging.DEBUG) +handler = handlers.RotatingFileHandler( + filename=LOGFILE, + encoding=ENCODING, + mode="a", + maxBytes=6 * 1024 * 1024, + backupCount=6, + ) +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +handler.setFormatter(formatter) +logger.addHandler(handler) # *=========================================== Initializations intents = discord.Intents.default() @@ -70,19 +82,6 @@ async def on_ready(): # *================================== Run if __name__ == "__main__": - logger = logging.getLogger("discord") - logger.setLevel(logging.DEBUG) - handler = handlers.RotatingFileHandler( - filename=LOGFILE, - encoding=ENCODING, - mode="a", - maxBytes=6 * 1024 * 1024, - backupCount=6, - ) - formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") - handler.setFormatter(formatter) - logger.addHandler(handler) - logger.info("Starting discord bot") threads = [] logger.info("Starting discord bot: Creating threads")