File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -660,6 +660,11 @@ msgid ""
660660" logging calls which are out there in existing code will be using %-format "
661661"strings."
662662msgstr ""
663+ "日志调用(``logger.debug()`` 、``logger.info()`` "
664+ "等)接受的位置参数只会用于日志信息本身,而关键字参数仅用于日志调用的可选处理参数(如关键字参数 ``exc_info`` 表示应记录跟踪信息, "
665+ "``extra`` 则标识了需要加入日志的额外上下文信息)。所以不能直接用 :meth:`str.format` 或 "
666+ ":class:`string.Template` 语法进行日志调用,因为日志包在内部使用 %-f "
667+ "格式来合并格式串和参数变量。在保持向下兼容性时,这一点不会改变,因为已有代码中的所有日志调用都会使用%-f 格式串。"
663668
664669#: ../../howto/logging-cookbook.rst:1111
665670msgid ""
@@ -669,6 +674,8 @@ msgid ""
669674"will call ``str()`` on that object to get the actual format string. Consider"
670675" the following two classes::"
671676msgstr ""
677+ "还有一种方法可以构建自己的日志信息,就是利用 {}- 和 $- 格式。回想一下,任意对象都可用为日志信息的格式串,日志包将会调用该对象的 "
678+ "``str()`` 方法,以获取最终的格式串。不妨看下一下两个类:"
672679
673680#: ../../howto/logging-cookbook.rst:1135
674681msgid ""
You can’t perform that action at this time.
0 commit comments