aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-08-05 20:44:35 +0100
committerGravatar jesopo2018-08-05 20:44:35 +0100
commit0ab7c11cb8e71ff28d3626114b24592eec49ebf5 (patch)
treeed2474b8c19992262fbd1a632e5230c6f3e89566 /modules
parentalso empty command stdout when there's no !more (diff)
signature
use TimeRotatingFileHandler in logging.py
Diffstat (limited to 'modules')
-rw-r--r--modules/logging.py5
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)