def _loadsetting(): global _LOG_DIR, _LOG_LEVEL, _LOG_FILE, _SVR_PORT, _PROJ_NAME, _SVR_TYPE conf = Conf() _LOG_DIR = os.path.join(BASE_DIR, conf.get("LOG", "log.path", "logs")) # _SVR_PORT=conf.get_int("SVR","port",9999) _LOG_LEVEL = conf.get("LOG", "log.level", "info") _LOG_FILE = conf.get("LOG", "log.file", "log") _PROJ_NAME = conf.get("DEFAULT", "proj.name", "proj") # _SVR_TYPE = conf.get("SVR","type","udp") return
sys.setdefaultencoding('utf-8') import requests import logzero from logzero import logger as log from izen import helper from bs4 import BeautifulSoup from config import Conf, LFormatter from clint import textui cfg = Conf().cfg # 检查日志配置, 是否写入文件 if cfg.get('log.enabled', False): logzero.logfile( cfg.get('log.file_pth', '/tmp/igt.log'), maxBytes=cfg.get('log.file_size', 5) * 1000000, backupCount=cfg.get('log.file_backups', 3), loglevel=cfg.get('log.level', 10), ) # bagua = '☼✔❄✖✄' # bagua = '☰☷☳☴☵☲☶☱' # 乾(天), 坤(地), 震(雷), 巽(xun, 风), 坎(水), 离(火), 艮(山), 兑(泽) bagua = '🍺🍻♨️️😈☠' formatter = LFormatter(bagua) logzero.formatter(formatter) click_hint = '{}\nUSAGE: <cmd> {}'