log_config.py 文件源码

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

项目:storj-python-sdk 作者: Storj 项目源码 文件源码
def load_configuration(config_file=DEFAULT_CONFIG_FILE):
    """
    Loads logging configuration from the given configuration file.

    :param config_file:
        the configuration file (default=/etc/package/logging.conf)
    :type config_file: str
    """
    if not os.path.exists(config_file) or not os.path.isfile(config_file):
        msg = '%s configuration file does not exist!', config_file
        logging.getLogger(__name__).error(msg)
        raise ValueError(msg)

    try:
        config.fileConfig(config_file, disable_existing_loggers=False)
        logging.getLogger(__name__).info(
            '%s configuration file was loaded.', config_file)
    except Exception as e:
        logging.getLogger(__name__).error(
            'Failed to load configuration from %s!', config_file)
        logging.getLogger(__name__).debug(str(e), exc_info=True)
        raise e
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号