当前位置:网站首页>Super easy to use logzero
Super easy to use logzero
2022-07-03 02:43:00 【strawberry47】
python The built-in log library is really too difficult to use , It's not concise at all !
I found this wonderful under my friend's Amway logzero library , direct .info You can output , Output and color , file + Line number , Super convenience !
It will automatically output the log to the corresponding file , collocation tmux Use , Can be abandoned nohup The command !
Server skills (alias, tmux, htop,gpustat, zsh)
import logzero
nowtime = datetime.datetime.fromtimestamp(time.time()).strftime("%Y_%m_%d-%H_%M_%S")
logger_path = os.path.join(config['ENV']['OUT_PUT'], "logs", "[Baseline]_{}.log".format(nowtime))
logzero.logfile(logger_path)
logzero.logger.info("output")
Output file has time 、 Code line and other information 
from logzero import logger
# These log messages are sent to the console
logger.debug("hello %s", "world")
logger.info("info")
logger.warning("warn")
logger.error("error")
# This is how you'd log an exception
try:
raise Exception("this is a demo exception")
except Exception as e:
logger.exception(e)

边栏推荐
- Classes and objects - initialization and cleanup of objects - constructor call rules
- 【 tutoriel】 Chrome ferme les cors et les messages de la politique inter - domaines et apporte des cookies à travers les domaines
- Gbase 8C system table PG_ class
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- The Linux server needs to install the agent software EPS (agent) database
- GBase 8c系统表-pg_authid
- Javescript 0.1 + 0.2 = = 0.3 problem
- random shuffle注意
- tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
- sql server数据库添加 mdf数据库文件,遇到的报错
猜你喜欢

【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)

Random Shuffle attention

Summary of interview project technology stack

How to change the panet layer in yolov5 to bifpn

【翻译】具有集中控制平面的现代应用负载平衡
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信

《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨

Basic operation of binary tree (C language version)

Check log4j problems using stain analysis

Your family must be very poor if you fight like this!
随机推荐
Matlab tips (24) RBF, GRNN, PNN neural network
GBase 8c 函数/存储过程定义
【翻译】具有集中控制平面的现代应用负载平衡
[hcia]no.15 communication between VLANs
Restcloud ETL cross database data aggregation operation
Source code analysis | layout file loading process
为什么会选择框架?选择什么样的框架
HTB-Devel
random shuffle注意
Cvpr2022 remove rain and fog
Can netstat still play like this?
A2L file parsing based on CAN bus (2)
Hcip137-147 title + analysis
超好用的日志库 logzero
Cancer biopsy instruments and kits - market status and future development trends
面试项目技术栈总结
Gbase 8C system table PG_ authid
[tutorial] chrome turns off cross domain policies CORS and samesite, and brings cookies across domains
random shuffle注意
MUX VLAN Foundation