Python:一个不错的日志思想
2018-01-15 18:46
197 查看
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : my_func.py # @Author: wmy # @Date : 2018/1/15 # import time def log(): time_format = '%Y - %m - %d: %X' time_current = time.strftime(time_format) with open('log.txt', 'a+') as f: f.write('%s end !\n' %time_current) def get_up(): print('func 1: get_up') log() def eating(): print('fun 2: eating') log() def sleep(): print('func 3: sleep') log() count = 0; while count <10: get_up() eating() sleep() count +=1
日志对于一个软件系统来说很重要:本文借鉴的函数写日志思想还是值得学习的。
相关文章推荐
- Python:通过自定义系统级快捷键来控制程序开始或停止记录日志(使用小技巧解决一个貌似无解的问题)
- 一个不错的日志写入类
- Python:通过自定义系统级快捷键来控制程序开始或停止记录日志(使用小技巧解决一个貌似无解的问题)
- 一个日志框架的开源,有些不错的创意。
- 从Apache的日志文件收集和提供统计数据(一个Python插件架构的简单实现)
- Python实现日志自动记录功能(一个思路代码,详细可以自己扩展)
- 一个简单的基于编辑距离的英文单词查错(Python) - Muilpin.Miao的日志 - 网易博客
- AWStats 一个不错的Web/Mail/FTP日志分析工具
- Python实现一个Git日志统计分析的小工具
- python输出日志到文件(每天一个日志)
- python写的一个squid访问日志分析的小程序
- 一个简易的python脚本统计nginx日志里的url及大小
- 一个不错的Python博客
- python写的一个squid访问日志分析的小程序
- 解决多个py模块调用同一个python的logging模块,打印日志冲突问题
- 一个不错输出日志文件代码
- Python切分字符串的一个不错方法
- 【一个不错的oracle数据库诊断例子,值得学习一下】Oracle数据库诊断案例-redo log日志组处于高激活状态
- python实时分析日志的一个小脚本分享
- python写一个日志查询工具(登录ftp服务器得到日志并分析)