1 Star 8 Fork 3

月夜行梦 / ddns-aliyun

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
logger.py 520 Bytes
一键复制 编辑 原始数据 按行查看 历史
月夜行梦 提交于 2020-11-25 00:20 . add logging
import json
import logging.config
import os
def setup_logging(default_path = "logging.json",default_level = logging.INFO,env_key = "LOG_CFG"):
path = default_path
value = os.getenv(env_key,None)
if value:
path = value
if os.path.exists(path):
with open(path,"r") as f:
config = json.load(f)
logging.config.dictConfig(config)
else:
logging.basicConfig(level = default_level)
if __name__ == "__main__":
setup_logging(default_path = "logging.json")
Python
1
https://gitee.com/tdg/ddns-aliyun.git
git@gitee.com:tdg/ddns-aliyun.git
tdg
ddns-aliyun
ddns-aliyun
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891