当前位置:网站首页>超好用的日志库 logzero
超好用的日志库 logzero
2022-07-03 02:39:00 【strawberry47】
python自带的日志库实在是太难用了,一点都不简洁!
在朋友的安利下发现了这个超棒的logzero库,直接 .info就可以输出,输出还有颜色,文件 + 行号,超级方便!
它会自动输出日志到对应文件,搭配tmux使用,可以抛弃nohup命令了!
服务器小技能(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")
输出文件有时间、代码行等信息
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)

边栏推荐
- Monitoring and management of JVM
- Compréhension simple de SVG
- Restcloud ETL cross database data aggregation operation
- Build a private cloud disk cloudrev
- Simple understanding of SVG
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
- GBase 8c系统表-pg_amop
- Add automatic model generation function to hade
- UDP receive queue and multiple initialization test
- COM and cn
猜你喜欢

"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b

HTB-Devel

awk从入门到入土(0)awk概述

内存池(内核角度理解new开辟空间的过程)
![[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)](/img/04/88ce45d370a2e6052c2fce558aa531.jpg)
[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)

Tongda OA homepage portal workbench

Detailed analysis of micro service component sentinel (hystrix)

What does "where 1=1" mean

where 1=1 是什么意思

Classes and objects - initialization and cleanup of objects - constructor call rules
随机推荐
GBase 8c系统表-pg_aggregate
面试八股文整理版
SQL Server Query spécifie la structure de la table
左值右指解释的比较好的
Check log4j problems using stain analysis
簡單理解svg
【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
Gbase 8C trigger (II)
2022-2028 global splicing display industry research and trend analysis report
sql server数据库添加 mdf数据库文件,遇到的报错
GBase 8c 函数/存储过程参数(二)
[advanced ROS] Lesson 6 recording and playback in ROS (rosbag)
Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
COM and cn
awk从入门到入土(1)awk初次会面
Gbase 8C system table PG_ class
Awk from entry to burial (1) awk first meeting
random shuffle注意
Gbase 8C system table PG_ auth_ members
为什么会选择框架?选择什么样的框架