Skip to content

Commit

Permalink
[SW-195525] INC Logger: Support ENABLE_CONSOLE values 1/0
Browse files Browse the repository at this point in the history
Add support for values '1' and '0' for 'ENABLE_CONSOLE' env var

Change-Id: I53f71250d7a74d2a8050aa1722b75acaebef0c4c
  • Loading branch information
Tiefen-boop committed Aug 6, 2024
1 parent b42b018 commit c7aa37c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions neural_compressor/torch/algorithms/fp8_quant/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def __new__(cls):

def get_enable_console_val(self):
enableConsole = os.environ.get("ENABLE_CONSOLE", "False").upper()
if enableConsole not in ["TRUE", "FALSE"]:
raise Exception("Env var 'ENABLE_CONSOLE' has to be true or false.")
return enableConsole == "TRUE"
if enableConsole not in ["TRUE", "FALSE", "1", "0"]:
raise Exception("Env var 'ENABLE_CONSOLE' has to be 'true' or 'false' ('1' or '0' respectively).")
return enableConsole == "TRUE" or enableConsole == "1"

def get_log_level(self):
log_level_str = os.environ.get("LOG_LEVEL_HQT", os.environ.get("LOG_LEVEL_ALL"))
Expand Down

0 comments on commit c7aa37c

Please sign in to comment.