From ec2382e1bdf92825a8b04c35e603299bb0375701 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 30 Dec 2020 13:06:12 -0800 Subject: [PATCH] Change file handler to rotate logs --- inquisitor/configs/resolver.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inquisitor/configs/resolver.py b/inquisitor/configs/resolver.py index 335a345..64d4fa4 100644 --- a/inquisitor/configs/resolver.py +++ b/inquisitor/configs/resolver.py @@ -135,7 +135,11 @@ def add_logging_handler(verbose, log_filename): logging.INFO ) handler = ( - logging.FileHandler(log_filename, encoding='utf8') + logging.handlers.RotatingFileHandler( + log_filename, + encoding='utf8', + maxBytes=2**22, # 4 MB per log file + backupCount=4) # 16 MB total if log_filename else logging.StreamHandler() )