From 23f1da515bdc6f399b713d24faecb94c9437585e Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Sat, 13 Feb 2021 15:38:26 +0000 Subject: [PATCH] Fix logging to individual files --- helpers/logging_manager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helpers/logging_manager.py b/helpers/logging_manager.py index 11c44e6..359cdf1 100644 --- a/helpers/logging_manager.py +++ b/helpers/logging_manager.py @@ -20,12 +20,20 @@ class LoggingManager(): print("Failed to create log file") return + # Set root the logging options. logging.basicConfig( filename=filename, format='%(asctime)s | %(levelname)s | %(message)s', level=logging.INFO, filemode='a' ) + + self.logger.setLevel(logging.INFO) + fh = logging.FileHandler(filename) + formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(message)s') + fh.setFormatter(formatter) + # add the handler to the logger + self.logger.addHandler(fh) self.logger.info("** LOGGER STARTED **") def __del__(self):