diff options
| author | 2018-08-05 20:44:35 +0100 | |
|---|---|---|
| committer | 2018-08-05 20:44:35 +0100 | |
| commit | 0ab7c11cb8e71ff28d3626114b24592eec49ebf5 (patch) | |
| tree | ed2474b8c19992262fbd1a632e5230c6f3e89566 /modules | |
| parent | also empty command stdout when there's no !more (diff) | |
| signature | ||
use TimeRotatingFileHandler in logging.py
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/logging.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/logging.py b/modules/logging.py index 4876741b..46f8bb29 100644 --- a/modules/logging.py +++ b/modules/logging.py @@ -1,4 +1,4 @@ -import logging, sys, time +import logging, logging.handlers, sys, time class BitBotFormatter(logging.Formatter): def formatTime(self, record, datefmt=None): @@ -27,7 +27,8 @@ class Module(object): stdout_handler.setFormatter(formatter) self.logger.addHandler(stdout_handler) - file_handler = logging.FileHandler('bot.log') + file_handler = logging.handlers.TimedRotatingFileHandler( + "bot.log", when="midnight", backupCount=5) file_handler.setLevel(logging.DEBUG) file_handler.setFormatter(formatter) self.logger.addHandler(file_handler) |
