python loguru 日志模块

本文深入探讨了Python中用于日志记录的Loguru库,它提供了一种简洁而强大的方式来管理和定制应用程序的日志输出。通过Loguru,你可以轻松地设置日志级别、添加文件输出、自定义格式以及处理异常。无论你是初学者还是经验丰富的开发者,Loguru都能让你的日志管理工作变得更简单。
摘要由CSDN通过智能技术生成
"""
sink 日志保存地方

level 发送到接收器的最低严重级别
级别    值    方法
TRACE   5   logger.trace()
DEBUG   10  logger.debug()
INFO    20  logger.info()
SUCCESS 25  logger.success()
WARNING 30  logger.warning()
ERROR   40  logger.error()
CRITICAL    50  logger.critical()

format 格式化模版
Key 官方描述    备注
elapsed The time elapsed since the start of the program     日期
exception  The formatted exception if any, none otherwise   
extra   The dict of attributes bound by the user (see bind())
file    The file where the logging call was made    出错文件
function    The function from which the logging call was made   出错方法
level   The severity used to log the message    日志级别
line    The line number in the source code  行数
message The logged message (not yet formatted)  信息
module  The module where the logging call was made  模块
name  The __name__ where the logging call was made  __name__
process The process in which the logging call was made  进程id或者进程名,默认是id
thread  The thre
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值