Skip to content

Commit 621493b

Browse files
committed
fix(logging): update log conf filename
Signed-off-by: Chris Snow <[email protected]>
1 parent 7370367 commit 621493b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

hpecp/logger.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ class Logger(object):
3030
@classmethod
3131
def get_logger(cls):
3232

33-
if "HPECP_LOG_CONF_FILE" in os.environ:
34-
logging.config.fileConfig(os.getenv("HPECP_LOG_CONF_FILE"))
33+
if "HPECP_LOG_CONFIG_FILE" in os.environ:
34+
logging.config.fileConfig(os.getenv("HPECP_LOG_CONFIG_FILE"))
35+
Logger.logger = logging.getLogger("HPECP_CLI")
36+
else:
37+
format = (
38+
"%(asctime)s - %(filename)s "
39+
"- %(name)s - %(levelname)s - %(message)s"
40+
)
41+
logging.basicConfig(format=format)
42+
Logger.logger = logging.getLogger("HPECP_CLI")
43+
Logger.logger.setLevel(os.getenv("LOG_LEVEL", logging.INFO))
3544

36-
format = (
37-
"%(asctime)s - %(filename)s "
38-
"- %(name)s - %(levelname)s - %(message)s"
39-
)
40-
logging.basicConfig(format=format)
41-
Logger.logger = logging.getLogger("HPECP_CLI")
42-
Logger.logger.setLevel(os.getenv("LOG_LEVEL", logging.INFO))
4345
return Logger.logger

0 commit comments

Comments
 (0)