当前位置:网站首页>Test log of unittest framework
Test log of unittest framework
2022-06-21 17:02:00 【Expert of explosive liver fist】
journal : Generally speaking, it is a historical record
According to your own needs , Write output log contents
Case code :
import time
def test_log():
# establish log.txt file , And add the log information (a+)
file=open('./log.txt','a+')
# Get the current time of the system
sys_time=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
# Get the current function name
file_name= test_log.__name__
# Combine one message
info = '['+ sys_time +']'+''+ file_name +''+'\n'
print(info)
# take info Data recorded to log.txt In file
file.write(info)
# Close file
file.close()
test_log()
Running results :

边栏推荐
- Huawei cloud releases desktop ide codearts
- Cisco(59)——Hub&Spoke MPLS
- Ares阿瑞斯i质押LP挖矿众筹模式dapp智能合约定制
- Standing at the digital tuyere, how can tooling enterprises' fly up '
- Why do you want to develop tea mall applet app?
- 机器学习中的概念漂移(Aporia)
- 使用 Guzzle 中间件进行优雅的请求重试
- 聚焦工业智能化场景,华为云招募合作伙伴,帮助解决转型难题
- Web page automation practice 5. get the name, price and rating information of all hotels and write them into the file
- The database cannot be connected. I don't know what's wrong
猜你喜欢
随机推荐
Introduction to mqtt protocol
好用不贵!11款开源自动化安全测试工具简介
微信小程序开发入门介绍-布局组件
鲁班会开发者深度论坛丨与成都伙伴一起 “洞见物联网新风潮”
Complete tutorial on reinstalling your computer system
[observation] Microsoft's "cloud + end" comprehensive innovation makes hybrid cloud simpler, more flexible and more secure
Go language development code self test excellent go fuzzing usage explanation
Deep understanding of zero copy technology
VNC Viewer方式的远程连接树莓派
I dare to break in, I can create! Gaussdb proposition of the 8th "Internet +" competition is open for registration!
在线文本列表批量添加行号工具
互联网公司做单元测试吗?银行的需求有必要做单元测试吗?
Advanced performance test series 6. problem solving and application development
Advanced performance test series 2. software performance test, load test and stress test
Standing at the digital tuyere, how can tooling enterprises' fly up '
Advanced performance test series 3. performance index, reliability test, capacity test and performance test
About SQL: does anyone in SQL know how to answer these questions?
机器学习模型监控(Aporia)
[理论]--接口测试
Huawei (13) - route introduction








