This commit is contained in:
liwanlei 2017-08-11 15:38:59 +08:00
parent 2bf8d6b573
commit bb62f5ce84
10 changed files with 6 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,22 +2,16 @@ import logging,os,time
class log_message:
def __init__(self,title):
# time
self.day=time.strftime("%Y%m%d",time.localtime(time.time()))
#创建一个logger
self.logger=logging.getLogger(title)
self.logger.setLevel(logging.INFO)
#创建Heandler 用于写入文件
self.logfile=logging.FileHandler(r'C:\Users\Administrator\Desktop\te_blogf\lo\%s.log'%self.day)
self.logfile.setLevel(logging.INFO)
#创建Heandler 用于显示控制台
self.control=logging.StreamHandler()
self.control.setLevel(logging.INFO)
#定义输出格式
self.formatter=logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
self.logfile.setFormatter(self.formatter)
self.control.setFormatter(self.formatter)
#给logger添加handler
self.logger.addHandler(self.logfile)
self.logger.addHandler(self.control)
def debug_log(self,message):

View File

@ -51,5 +51,4 @@ def create_report_sendemali(now):
print('send is ok!!!')
if __name__=="__main__":
now=create_report()
print(now)
create_report_sendemali(now)

6
run.py Normal file
View File

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# @Date : 2017-08-11 15:34:37
# @Author : lileilei
from report.email_report import create_report
if __name__ == '__main__':
create_report()