Fix logging to individual files

This commit is contained in:
Matthew Stratford 2021-02-13 15:38:26 +00:00
parent 2fcd640a8d
commit 23f1da515b

View file

@ -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):