exclude connexion logging even in debug mode
This commit is contained in:
parent
a38aa139a6
commit
1f2845962c
|
@ -161,6 +161,9 @@ def setup_logger(app: Flask) -> None:
|
||||||
spiff_logger_filehandler.setLevel(spiff_log_level)
|
spiff_logger_filehandler.setLevel(spiff_log_level)
|
||||||
spiff_logger_filehandler.setFormatter(log_formatter)
|
spiff_logger_filehandler.setFormatter(log_formatter)
|
||||||
|
|
||||||
|
# these loggers have been deemed too verbose to be useful
|
||||||
|
garbage_loggers_to_exclude = ["connexion"]
|
||||||
|
|
||||||
# make all loggers act the same
|
# make all loggers act the same
|
||||||
for name in logging.root.manager.loggerDict:
|
for name in logging.root.manager.loggerDict:
|
||||||
# use a regex so spiffworkflow_backend isn't filtered out
|
# use a regex so spiffworkflow_backend isn't filtered out
|
||||||
|
@ -172,10 +175,15 @@ def setup_logger(app: Flask) -> None:
|
||||||
the_logger.propagate = False
|
the_logger.propagate = False
|
||||||
the_logger.addHandler(spiff_logger_filehandler)
|
the_logger.addHandler(spiff_logger_filehandler)
|
||||||
else:
|
else:
|
||||||
if len(the_logger.handlers) < 1:
|
# it's very verbose, so only add handlers for the obscure loggers when log level is DEBUG
|
||||||
# it's very verbose, so only add handlers for the obscure loggers when log level is DEBUG
|
if upper_log_level_string == "DEBUG":
|
||||||
if upper_log_level_string == "DEBUG":
|
if len(the_logger.handlers) < 1:
|
||||||
the_logger.addHandler(logging.StreamHandler(sys.stdout))
|
exclude_logger_name_from_logging = False
|
||||||
|
for garbage_logger in garbage_loggers_to_exclude:
|
||||||
|
if name.startswith(garbage_logger):
|
||||||
|
exclude_logger_name_from_logging = True
|
||||||
|
if not exclude_logger_name_from_logging:
|
||||||
|
the_logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
for the_handler in the_logger.handlers:
|
for the_handler in the_logger.handlers:
|
||||||
the_handler.setFormatter(log_formatter)
|
the_handler.setFormatter(log_formatter)
|
||||||
the_handler.setLevel(log_level)
|
the_handler.setLevel(log_level)
|
||||||
|
|
Loading…
Reference in New Issue