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
评论列表
文章目录