当前位置:网站首页>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)

边栏推荐
- sql server 查询指定表的表结构
- Restcloud ETL cross database data aggregation operation
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
- Strategy application of Dameng database
- The core idea of performance optimization, dry goods sharing
- Pytest (6) -fixture (Firmware)
- Cancer biopsy instruments and kits - market status and future development trends
- Use cve-2021-43893 to delete files on the domain controller
- tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
- Xiaodi notes
猜你喜欢

Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution

Kubernetes cluster log and efk architecture log scheme

Build a private cloud disk cloudrev
![[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)](/img/6a/ae44ddb090ce6373f04a550a15f973.jpg)
[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)

Pytest (6) -fixture (Firmware)

Restcloud ETL cross database data aggregation operation
![ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc](/img/cb/145937a27ef08050a370d5a255215a.jpg)
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc

【翻译】后台项目加入了CNCF孵化器
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信

random shuffle注意
随机推荐
GBase 8c系统表-pg_amproc
当lambda没有输入时,是何含义?
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Gbase 8C trigger (III)
Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
[hcia]no.15 communication between VLANs
Classes and objects - initialization and cleanup of objects - constructor call rules
Serious security vulnerabilities reported by moxa mxview network management software
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
搭建私有云盘 cloudreve
Gbase 8C system table PG_ aggregate
[translation] flux is safe. Gain more confidence through fuzzy processing
簡單理解svg
Counter统计数量后,如何返回有序的key
The Linux server needs to install the agent software EPS (agent) database
Use cve-2021-43893 to delete files on the domain controller
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
GBase 8c触发器(三)
MUX VLAN Foundation
定了,就选它