如何为 structlog 设置日志级别
你可以使用 logging 模块设置 structlog 日志级别:
structlog_set_level_examples.py
import logging
# 示例 1:仅输出 DEBUG 及更高级别
structlog.configure(
wrapper_class=structlog.make_filtering_bound_logger(logging.DEBUG),
)
# 示例 2:仅输出 INFO 及更高级别
structlog.configure(
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
)Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow