【发布时间】:2021-07-04 12:10:13
【问题描述】:
pylint 产生以下警告:
记录格式插值 (W1202):
在日志记录函数中使用 % 格式并将 % 参数传递为 参数 当日志语句的调用形式为 “记录。(format_string.format(format_args ...))”。此类电话应 改用 % 格式,但将插值留给日志记录 通过将参数作为参数传递来函数。
所以正确的记录方式是:logger.error('oops caused by %s', exc)
但是如何传递多个参数呢?有类似的东西:
logger.error('oops caused by %s %s')(在哪里放exc_one,exc_two?)
【问题讨论】:
标签: python logging pylint string-interpolation