From 35e90aa2903bb1e99972b4ca2026201dcd437bda Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Fri, 8 Apr 2022 21:32:31 -0400 Subject: [PATCH] Created a 'debug' log file to keep one log file clean --- BotResources.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BotResources.py b/BotResources.py index b8b8c43..0020b99 100644 --- a/BotResources.py +++ b/BotResources.py @@ -227,19 +227,25 @@ def init_global_logger(_verbose_level: str = "WARNING"): fh = logging.FileHandler(f'./logs/DRB-{date.today()}.log') fh.setLevel(logging.DEBUG) + fh_debug = logging.FileHandler(f'./logs/DRB-{date.today()}.DEBUG.log') + fh_debug.setLevel(logging.WARNING) + # create terminal handler with a higher log level th = logging.StreamHandler() th.setLevel(numeric_log_level) # create formatter and add it to the handlers - fh_formatter = logging.Formatter('[%(asctime)s %(name)s->%(funcName)s():%(lineno)s] - %(levelname)s - %(message)s') + fh_debug_formatter = logging.Formatter('[%(asctime)s %(name)s->%(funcName)s():%(lineno)s] - %(levelname)s - %(message)s') + fh_formatter = logging.Formatter('[%(asctime)s %(name)s->%(funcName)s()] - %(levelname)s - %(message)s') th_formatter = logging.Formatter('[%(asctime)s %(name)s->%(funcName)s()] - %(levelname)s - %(message)s') + fh_debug.setFormatter(fh_debug_formatter) fh.setFormatter(fh_formatter) th.setFormatter(th_formatter) # add the handlers to the logger init_logger.addHandler(fh) init_logger.addHandler(th) + init_logger.addHandler(fh_debug) #if __name__ is not 'main':