接口自動化(五)--打印log到文檔
阿新 • • 發佈:2018-02-02
line port gin 接口 lin eno mode bsp sage
這一部分實現比較簡單,直接上代碼:
1 import logging 2 3 class Logger(): 4 def __init__(self,content,*raw): 5 self.content = content 6 7 def log(self): 8 logging.basicConfig(level=logging.DEBUG, 9 format=‘%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s‘, 10 datefmt=‘%a, %d %b %Y %H:%M:%S‘, 11 filename=‘mylog.log‘, 12 filemode=‘w‘) 13 logging.info(self.content)
打印出來的效果把代碼拷出試一下就知道了
接口自動化(五)--打印log到文檔