当前位置:网站首页>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)
边栏推荐
- GBase 8c系统表-pg_attribute
- Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
- GBase 8c 函数/存储过程定义
- "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
- Kubernetes cluster log and efk architecture log scheme
- HW initial preparation
- cvpr2022去雨去雾
- Kubernetes family container housekeeper pod online Q & A?
- easyPOI
- 错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
猜你喜欢
Your family must be very poor if you fight like this!
Baidu map - surrounding search
[translation] modern application load balancing with centralized control plane
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
Linear rectification function relu and its variants in deep learning activation function
random shuffle注意
What is the way out for children from poor families?
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
Random shuffle note
Pytest (6) -fixture (Firmware)
随机推荐
GBase 8c系统表-pg_attribute
The left value and the right finger explain better
Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
GBase 8c 函数/存储过程参数(二)
GBase 8c触发器(三)
Gbase 8C system table PG_ constraint
Build a private cloud disk cloudrev
MUX VLAN Foundation
简单理解svg
GBase 8c系统表-pg_am
[translation] modern application load balancing with centralized control plane
QT qcombobox add qccheckbox (drop-down list box insert check box, including source code + comments)
GBase 8c 函数/存储过程参数(一)
Tongda OA V12 process center
SQL Server Query spécifie la structure de la table
Restcloud ETL cross database data aggregation operation
HTB-Devel
搭建私有云盘 cloudreve
Cancer biopsy instruments and kits - market status and future development trends
[hcia]no.15 communication between VLANs