More specific log output
This commit is contained in:
@@ -227,14 +227,15 @@ def init_global_logger(_verbose_level: str = "WARNING"):
|
||||
fh = logging.FileHandler(f'./logs/DRB-{date.today()}.log')
|
||||
fh.setLevel(logging.DEBUG)
|
||||
|
||||
# create console handler with a higher log level
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(numeric_log_level)
|
||||
# create terminal handler with a higher log level
|
||||
th = logging.StreamHandler()
|
||||
th.setLevel(numeric_log_level)
|
||||
|
||||
# create formatter and add it to the handlers
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
fh.setFormatter(formatter)
|
||||
ch.setFormatter(formatter)
|
||||
th_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')
|
||||
fh.setFormatter(fh_formatter)
|
||||
th.setFormatter(th_formatter)
|
||||
|
||||
# add the handlers to the logger
|
||||
init_logger.addHandler(fh)
|
||||
|
||||
Reference in New Issue
Block a user