mirror of
https://github.com/UiO-Gaming/ShiteMusicBot.git
synced 2026-11-05 13:56:51 +01:00
Use time rotating file handler instead
This commit is contained in:
1 parent
cdafead84a
commit
4fe46c8aa3
1 file changed
+2
-2
@@ -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)
|
||||||
Reference in new issue
Block a user