new logging handlers

This commit is contained in:
Specoolazius 2022-03-30 21:50:07 +02:00
parent 021b076a2c
commit 63ca1fd2bd

View File

@ -159,11 +159,17 @@ class BotClient(discord.Bot, ABC):
logger = logging.getLogger('discord')
logger.setLevel(level)
handler = logging.FileHandler(filename=f'{os.path.join(*path_list, "") or ""}discord.log', encoding='utf-8',
mode='w')
handler.setFormatter(logging.Formatter(fmt='[%(asctime)s] - %(levelname)s: %(name)s: %(message)s'))
formatter = logging.Formatter(fmt='[%(asctime)s] - %(levelname)s: %(name)s: %(message)s')
file_handler = logging.FileHandler(filename=f'{os.path.join(*path_list, "") or ""}discord.log',
encoding='utf-8', mode='w')
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
logger.addHandler(handler)
return logger
async def on_ready(self) -> None: