utils.py 文件源码

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

项目:glog-cli 作者: globocom 项目源码 文件源码
def get_config(config_file_path="~/.glogcli.cfg"):
    config = configparser.ConfigParser()
    try:
        open(os.path.expanduser(config_file_path))
    except Exception:
        click.echo("[WARNING] - Could not find %s file. Please create the configuration file like:" % config_file_path)
        click.echo("\n[environment:default]\n"
                   "host=mygraylogserver.com\n"
                   "port=443\n"
                   "username=john.doe\n"
                   "default_stream=*\n"
                   "\n"
                   "[environment:dev]\n"
                   "host=mygraylogserver.dev.com\n"
                   "port=443\n"
                   "proxy=mycompanyproxy.com\n"
                   "username=john.doe\n"
                   "default_stream=57e14cde6fb78216a60d35e8\n"
                   "\n"
                   "[format:default]\n"
                   "format={host} {level} {facility} {timestamp} {message}\n"
                   "\n"
                   "[format:short]\n"
                   "format=[{timestamp}] {level} {message}\n"
                   "\n"
                   "[format:long]\n"
                   "format=time: [{timestamp}] level: {level} msg: {message} tags: {tags}\n"
                   "color=false\n"
                   "\n")

    config.read(os.path.expanduser(config_file_path))
    return config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号