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

边栏推荐
- HW initial preparation
- Gbase 8C function / stored procedure definition
- Gbase 8C system table PG_ cast
- Gbase 8C create user / role example 2
- A2L file parsing based on CAN bus (2)
- Tongda OA V12 process center
- 基于can总线的A2L文件解析(2)
- [translation] the background project has joined the CNCF incubator
- [hcia]no.15 communication between VLANs
- cvpr2022去雨去雾
猜你喜欢

Joking about Domain Driven Design (III) -- Dilemma

oauth2.0鉴权,登录访问 “/oauth/token”,请求头Authorization(basicToken)如何取值???
![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

Classes and objects - initialization and cleanup of objects - constructor call rules

搭建私有云盘 cloudreve

错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
![[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)
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信

Linear rectification function relu and its variants in deep learning activation function

Random shuffle note
随机推荐
[translation] the background project has joined the CNCF incubator
Getting started | jetpack hilt dependency injection framework
HTB-Devel
Strategy application of Dameng database
Principle and application of database
Tongda OA homepage portal workbench
Two dimensional format array format index subscript continuity problem leads to return JSON format problem
GBase 8c系统表pg_database
【 tutoriel】 Chrome ferme les cors et les messages de la politique inter - domaines et apporte des cookies à travers les domaines
Linear rectification function relu and its variants in deep learning activation function
GBase 8c系统表-pg_attribute
Add MDF database file to SQL Server database, and the error is reported
处理数据集,使用LabelEncoder将所有id转换为从0开始
Can netstat still play like this?
SQL server queries the table structure of the specified table
Gbase 8C system table PG_ attribute
Gbase 8C system table PG_ collation
GBase 8c系统表-pg_authid
Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
Classes and objects - initialization and cleanup of objects - constructor call rules