当前位置:网站首页>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_conversion
- Tongda OA homepage portal workbench
- Can netstat still play like this?
- 面试项目技术栈总结
- Summary of interview project technology stack
- Kubernetes family container housekeeper pod online Q & A?
- GBase 8c系统表-pg_collation
- Gbase 8C system table PG_ auth_ members
- 【教程】chrome关闭跨域策略cors、samesite,跨域带上cookie
- [shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
猜你喜欢

What is the way out for children from poor families?

SQL statement

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

easyPOI

where 1=1 是什么意思

Tongda OA homepage portal workbench

Today, it's time to copy the bottom!
![[shutter] banner carousel component (shutter_wiper plug-in | swiper component)](/img/a6/5c97ef3f34702b83ebf0511501d757.gif)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)

HTB-Devel

Kubernetes family container housekeeper pod online Q & A?
随机推荐
A2L file parsing based on CAN bus (2)
Pytest (6) -fixture (Firmware)
MUX VLAN Foundation
Two dimensional format array format index subscript continuity problem leads to return JSON format problem
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
Principle and application of database
Can netstat still play like this?
[hcia]no.15 communication between VLANs
tensor中的append应该如何实现
Kubernetes family container housekeeper pod online Q & A?
sql server数据库添加 mdf数据库文件,遇到的报错
Summary of interview project technology stack
HTB-Devel
面试项目技术栈总结
Hcip137-147 title + analysis
[translation] modern application load balancing with centralized control plane
easyPOI
GBase 8c 创建用户/角色 示例二
C语言中左值和右值的区别
Packing and unpacking of JS