From 221f8ceee535cbf4e9b9fa7a3158236845c78b49 Mon Sep 17 00:00:00 2001 From: Uwe Pfeifer Date: Wed, 17 Aug 2022 15:32:47 +0200 Subject: [PATCH] Fixed logging but not configurable anymore. --- pybot-f.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pybot-f.py b/pybot-f.py index 47925c7..459cd02 100644 --- a/pybot-f.py +++ b/pybot-f.py @@ -8,8 +8,12 @@ import typing from discord.ext import commands import logging -# Logging -loghandler = logging.FileHandler(filename='bot.log', encoding='utf-8', mode='w') +# Logging +logger = logging.getLogger('discord') +logger.setLevel(logging.INFO) +handler = logging.FileHandler(filename='bot.log', encoding='utf-8', mode='w') +handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')) +logger.addHandler(handler) # The bots' description description = '''Testing this bot stuff :)''' @@ -26,11 +30,10 @@ config = configparser.ConfigParser() config.read('bot.ini') bottoken = config['General']['bottoken'] -loglevel = logging.getLevelName(config['General']['loglevel']) # Setting up commands.Bot -bot = commands.Bot(command_prefix='.', description=description, intents=intents, log_handler=loghandler, log_level=loglevel) +bot = commands.Bot(command_prefix='.', description=description, intents=intents) @bot.event