@@ -716,18 +716,21 @@ msgid ""
716716"not just the format string. That's because the __ notation is just syntax "
717717"sugar for a constructor call to one of the XXXMessage classes."
718718msgstr ""
719+ "值得注意的是,上述做法对性能并没什么影响:格式化过程其实不是在日志记录调用时发生的,而是在日志信息即将由 handler "
720+ "输出到日志时发生。因此,唯一可能让人困惑的稍不寻常的地方,就是包裹在格式串和参数外面的括号,而不是格式串。因为 __ 符号只是对 XXXMessage "
721+ "类的构造函数调用的语法糖。"
719722
720723#: ../../howto/logging-cookbook.rst:1177
721724msgid ""
722725"If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar "
723726"effect to the above, as in the following example::"
724- msgstr ""
727+ msgstr "只要愿意,上述类似的效果即可用 :class:`LoggerAdapter` 实现,如下例所示: "
725728
726729#: ../../howto/logging-cookbook.rst:1208
727730msgid ""
728731"The above script should log the message ``Hello, world!`` when run with "
729732"Python 3.2 or later."
730- msgstr ""
733+ msgstr "在用 Python 3.2 以上版本运行时,上述代码应该会把 ``Hello, world!`` 写入日志。 "
731734
732735#: ../../howto/logging-cookbook.rst:1217
733736msgid "Customizing ``LogRecord``"
@@ -743,12 +746,16 @@ msgid ""
743746"disabled). Before Python 3.2, there were only two places where this creation"
744747" was done:"
745748msgstr ""
749+ "每条日志事件都由一个 :class:`LogRecord` 实例表示。当某事件要记入日志并且没有被某级别过滤掉时,就会创建一个 "
750+ ":class:`LogRecord` 对象,并将有关事件的信息填入,传给该日志对象的 handler(及其祖先,直至对象禁止向上传播为止)。在 "
751+ "Python 3.2 之前,只有两个地方会进行事件的创建:"
746752
747753#: ../../howto/logging-cookbook.rst:1226
748754msgid ""
749755":meth:`Logger.makeRecord`, which is called in the normal process of logging "
750756"an event. This invoked :class:`LogRecord` directly to create an instance."
751757msgstr ""
758+ ":meth:`Logger.makeRecord`,在事件正常记入日志的过程中调用。这会直接调用 :class:`LogRecord` 来创建一个实例。"
752759
753760#: ../../howto/logging-cookbook.rst:1229
754761msgid ""
@@ -758,12 +765,15 @@ msgid ""
758765"via a :class:`~handlers.SocketHandler`, or in JSON form via an "
759766":class:`~handlers.HTTPHandler`)."
760767msgstr ""
768+ ":func:`makeLogRecord`,调用时会带上一个字典参数,其中存放着要加入 LogRecord "
769+ "的属性。这通常在通过网络接收到合适的字典时调用(如通过 :class:`~handlers.SocketHandler` 以 pickle 形式,或通过"
770+ " :class:`~handlers.HTTPHandler` 以 JSON 形式)。"
761771
762772#: ../../howto/logging-cookbook.rst:1235
763773msgid ""
764774"This has usually meant that if you need to do anything special with a "
765775":class:`LogRecord`, you've had to do one of the following."
766- msgstr ""
776+ msgstr "于是这意味着若要对 :class:`LogRecord` 进行定制,必须进行下述某种操作。 "
767777
768778#: ../../howto/logging-cookbook.rst:1238
769779msgid ""
0 commit comments