Use time rotating file handler instead

This commit is contained in:
Ev-1 committed 2022-10-09 14:11:48 +02:00
1 parent cdafead84a
commit 4fe46c8aa3
1 file changed
+2 -2
+2 -2
View File
@@ -54,8 +54,8 @@ class BotLogger(object):
self.bot_logger.info(f"Creating logging directory: {self.log_location}") self.bot_logger.info(f"Creating logging directory: {self.log_location}")
if self.log_level: if self.log_level:
self.bot_logger.info(f"Logging directory: {self.log_location}") self.bot_logger.info(f"Logging directory: {self.log_location}")
file_logger = logging.handlers.RotatingFileHandler(f'{self.log_location}/bot.log', mode='a', file_logger = logging.handlers.TimedRotatingFileHandler(f'{self.log_location}/bot.log',
maxBytes=5000, encoding="UTF-8", delay=0, backupCount=5) when="midnight", encoding="UTF-8", backupCount=5)
file_logger.setLevel(self.log_level) file_logger.setLevel(self.log_level)
file_logger.setFormatter(file_format) file_logger.setFormatter(file_format)
self.bot_logger.addHandler(file_logger) self.bot_logger.addHandler(file_logger)