Created a 'debug' log file to keep one log file clean
This commit is contained in:
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user