def _get_log_config(filename=None):
"""Determines if there is a log config in the config directory
and returns it. If it does not exist, return None.
Arguments:
filename (str): The name of the logging config specific to the
transaction processor that is being started.
Returns:
log_config (dict): The dictionary to pass to logging.config.dictConfig
"""
if filename is not None:
conf_file = os.path.join(get_config_dir(), filename)
if os.path.exists(conf_file):
with open(conf_file) as fd:
raw_config = fd.read()
if filename.endswith(".yaml"):
log_config = yaml.safe_load(raw_config)
else:
log_config = toml.loads(raw_config)
return log_config
return None
评论列表
文章目录