Skip to content

Commit

Permalink
Changed the way specific_log_level flag works in the Logging Config…
Browse files Browse the repository at this point in the history
…uration (tardis-sn#1769)

* Changed the logical implementation for the `specific` flag in the debug schema for logging

* Fixed the implementation with intended logic

* Added logic change for specific_log_level flag

* Changed check for specific_log_level parameter & setting it up via the YAML
  • Loading branch information
DhruvSondhi authored Sep 9, 2021
1 parent 8d9e29d commit e098c5c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tardis/io/logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"CRITICAL": logging.CRITICAL,
}
DEFAULT_LOG_LEVEL = "CRITICAL"
DEFAULT_SPECIFIC_STATE = False


class FilterLog(object):
Expand Down Expand Up @@ -106,14 +107,20 @@ def logging_state(log_level, tardis_config, specific_log_level):
)

else:
# Adds empty `debug` section for the YAML
tardis_config["debug"] = {}

if log_level:
logging_level = log_level
else:
tardis_config["debug"] = {"log_level": DEFAULT_LOG_LEVEL}
tardis_config["debug"]["log_level"] = DEFAULT_LOG_LEVEL
logging_level = tardis_config["debug"]["log_level"]

if specific_log_level:
specific_log_level = specific_log_level
if not specific_log_level:
tardis_config["debug"][
"specific_log_level"
] = DEFAULT_SPECIFIC_STATE
specific_log_level = tardis_config["debug"]["specific_log_level"]

logging_level = logging_level.upper()
if not logging_level in LOGGING_LEVELS:
Expand Down

0 comments on commit e098c5c

Please sign in to comment.