config.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:sawtooth-core 作者: hyperledger 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号