cc: reformat island_logger.py for readability

1. Adjusted some spacing and indentation
2. Reformatted with Black
This commit is contained in:
Mike Salvatore 2021-02-10 07:29:28 -05:00
parent fef44bcd05
commit 4cb28db3bc
1 changed files with 8 additions and 4 deletions

View File

@ -2,10 +2,12 @@ import json
import logging.config
import os
__author__ = 'Maor.Rayzin'
__author__ = "Maor.Rayzin"
def json_setup_logging(default_path='logging.json', default_level=logging.INFO, env_key='LOG_CFG'):
def json_setup_logging(
default_path="logging.json", default_level=logging.INFO, env_key="LOG_CFG"
):
"""
Setup the logging configuration
:param default_path: the default log configuration file path
@ -15,10 +17,12 @@ def json_setup_logging(default_path='logging.json', default_level=logging.INFO,
"""
path = default_path
value = os.getenv(env_key, None)
if value:
path = value
if os.path.exists(path):
with open(path, 'rt') as f:
with open(path, "rt") as f:
config = json.load(f)
logging.config.dictConfig(config)
else: