def _get_config():
"""Determines if there is a log config in the config directory
and returns it. If it does not exist, return None.
Returns:
log_config (dict): The dictionary to pass to logging.config.dictConfig
"""
conf_file = os.path.join(_get_config_dir(), 'log_config.toml')
if os.path.exists(conf_file):
with open(conf_file) as fd:
raw_config = fd.read()
log_config = toml.loads(raw_config)
return log_config
conf_file = os.path.join(_get_config_dir(), 'log_config.yaml')
if os.path.exists(conf_file):
with open(conf_file) as fd:
raw_config = fd.read()
log_config = yaml.safe_load(raw_config)
return log_config
return None
评论列表
文章目录