summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/app.py2
-rw-r--r--src/leap/bitmask/logs/utils.py12
2 files changed, 9 insertions, 5 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index aa4e304b..ca7eb1d3 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -145,7 +145,7 @@ def start_app():
flags.DEBUG = opts.debug
- logger = get_logger()
+ logger = get_logger(perform_rollover=True)
# NOTE: since we are not using this right now, the code that replaces the
# stdout needs to be reviewed when we enable this again
diff --git a/src/leap/bitmask/logs/utils.py b/src/leap/bitmask/logs/utils.py
index 413f6a75..d3aa322b 100644
--- a/src/leap/bitmask/logs/utils.py
+++ b/src/leap/bitmask/logs/utils.py
@@ -36,7 +36,7 @@ from logbook.more import ColorizedStderrHandler
BITMASK_LOG_FILE = os.path.join(get_path_prefix(), "leap", 'bitmask.log')
-def get_logger():
+def get_logger(perform_rollover=False):
"""
Push to the app stack the needed handlers and return a Logger object.
@@ -56,9 +56,13 @@ def get_logger():
level=level, filter=silencer.filter)
zmq_handler.push_application()
- file_handler = logbook.FileHandler(BITMASK_LOG_FILE,
- format_string=LOG_FORMAT, bubble=True,
- filter=silencer.filter)
+ file_handler = logbook.RotatingFileHandler(
+ BITMASK_LOG_FILE, format_string=LOG_FORMAT, bubble=True,
+ filter=silencer.filter, max_size=sys.maxint)
+
+ if perform_rollover:
+ file_handler.perform_rollover()
+
file_handler.push_application()
# don't use simple stream, go for colored log handler instead