封装日志模块
import logging
def get_log():
# 配置日志参数
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logfile = ‘C://Users/EDZ/PycharmProjects/untitled/appium_SH/report/logs/runlog.logs‘
fh = logging.FileHandler(logfile) # 日志输出到文件
fh.setLevel(logging.INFO)
ch = logging.StreamHandler() # 日志输出到控制台
ch.setLevel(logging.INFO)
formatter = logging.Formatter(‘%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s:%(message)s‘)
fh.setFormatter(formatter)
ch.setFormatter(formatter)
logger.addHandler(fh)
logger.addHandler(ch)
return logger
logger = get_log()
查看更多关于Python +appium logger的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did172338