Skip to content

Commit

Permalink
Setting default logging level to WARNING (#1086)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwen2501 authored Apr 24, 2024
1 parent 2104a68 commit a644820
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pippy/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
# - WARNING (default)
# - INFO
# - DEBUG
PIPPY_VERBOSITY = os.environ.get("PIPPY_VERBOSITY")
if PIPPY_VERBOSITY not in [None, "WARNING", "INFO", "DEBUG"]:
PIPPY_VERBOSITY = os.getenv("PIPPY_VERBOSITY", "WARNING")
if PIPPY_VERBOSITY not in ["WARNING", "INFO", "DEBUG"]:
logging.warning(f"Unsupported PIPPY_VERBOSITY level: {PIPPY_VERBOSITY}")
PIPPY_VERBOSITY = None
PIPPY_VERBOSITY = "WARNING"

if PIPPY_VERBOSITY:
logging.getLogger("pippy").setLevel(PIPPY_VERBOSITY)
# It seems we need to print something to make the level setting effective
# for child loggers. Doing it here.
logging.warning(f"Setting PiPPy logging level to: {PIPPY_VERBOSITY}")
logging.getLogger("pippy").setLevel(PIPPY_VERBOSITY)
# It seems we need to print something to make the level setting effective
# for child loggers. Doing it here.
logging.warning(f"Setting PiPPy logging level to: {PIPPY_VERBOSITY}")


def friendly_debug_info(v):
Expand Down

0 comments on commit a644820

Please sign in to comment.