Skip to content

Commit

Permalink
fix(log level): handling when no env var
Browse files Browse the repository at this point in the history
  • Loading branch information
lmeyerov committed Oct 18, 2023
1 parent 444ad54 commit 37e62c2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/python/util/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ def getChild(*args, **kwargs):

logger = logging.getLogger('gak')

if "LOG_LEVEL" in os.environ:
log_level=getattr(logging, os.environ["LOG_LEVEL"].upper())
else:
log_level=getattr(logging,logging.ERROR)

logger.debug(f"util.log envar LOG_LEVEL: {os.environ['LOG_LEVEL']}")
logger.debug(f"util.log log_level == {log_level}")
log_level_str = os.environ.get('LOG_LEVEL', 'ERROR').upper()
log_level = getattr(logging, log_level_str)
logger.debug(f"util.log log_level == {log_level_str} ({log_level})")

out=logger.getChild(*args, **kwargs)
out.setLevel(log_level)
Expand Down

0 comments on commit 37e62c2

Please sign in to comment.