码迷,mamicode.com
首页 > 编程语言 > 详细

如何用python写监控日志函数

时间:2017-06-17 14:23:51      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:param   use   python   open   content   operation   ret   strftime   pen   

def write_log(username,operation):
‘‘‘
写日志函数
:param username:用户名
:param operation:用户的操作信息
:return:
‘‘‘
w_time = time.strftime(‘%Y-%m-%d %H%M%S‘)
with open(‘log.txt‘,‘a+‘) as fw:
log_content = ‘%s %s %s \n‘%(w_time,username,operation)
fw.write(log_content)


如何用python写监控日志函数

标签:param   use   python   open   content   operation   ret   strftime   pen   

原文地址:http://www.cnblogs.com/snorth/p/7040032.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!