77# Fei Yin <[email protected] >, 20188899# Meng Du <[email protected] >, 201910- 1110# Freesand Leo <[email protected] >, 201911+ 1212#
1313#, fuzzy
1414msgid ""
@@ -17,7 +17,7 @@ msgstr ""
1717"Report-Msgid-Bugs-To : \n "
1818"POT-Creation-Date : 2019-01-01 10:14+0900\n "
1919"PO-Revision-Date : 2017-02-16 17:45+0000\n "
20- "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2019\n "
20+ "Last-Translator : 非法操作 <ultrahe@gmail .com>, 2019\n "
2121"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2222"MIME-Version : 1.0\n "
2323"Content-Type : text/plain; charset=UTF-8\n "
@@ -218,6 +218,7 @@ msgid ""
218218"suggestion to attach only ``QueueHandlers`` to your loggers) for the benefit"
219219" of other developers who will use your code."
220220msgstr ""
221+ "一种解决方案是分成两部分去处理。第一部分,针对那些对性能有要求的关键线程的日志记录附加一个:class:`QueueHandler`。日志记录器只需简单写入队列,该队列可以设置一个足够大的容量甚至不设置容量上限。通常写入队列是一个快速的操作,即使可能需要在代码中去捕获例如:exc:`queue.Full`等异常。如果你是一名处理关键线程的开发者,请务必记录这些信息(包括建议为日志处理器附加``QueueHandlers``)以便于其他开发者使用你的代码。"
221222
222223#: ../../howto/logging-cookbook.rst:357
223224msgid ""
@@ -229,6 +230,9 @@ msgid ""
229230"``LogRecords``, for that matter). The ``LogRecords`` are removed from the "
230231"queue and passed to the handlers for processing."
231232msgstr ""
233+ "另一部分是设计一个对应的 "
234+ ":class:`QueueListener`。它接收一个队列和日志处理器,使用内置的线程监听从``QueueHandlers``(或其他``LogRecords``来源)发送过来的日志记录队列。``LogRecords``"
235+ " 会从队列中移除并被日志处理器处理。"
232236
233237#: ../../howto/logging-cookbook.rst:365
234238msgid ""
@@ -238,14 +242,16 @@ msgid ""
238242"handler classes, which would eat up one thread per handler for no particular"
239243" benefit."
240244msgstr ""
245+ "使用一个单独的类 :class:`QueueListener` "
246+ "优点是可以使用同一个实例去服务于多个``QueueHandlers``。这样会更节省资源,否则每个处理程序都占用一个线程没有任何益处。"
241247
242248#: ../../howto/logging-cookbook.rst:370
243249msgid "An example of using these two classes follows (imports omitted)::"
244- msgstr ""
250+ msgstr "以下是使用了这样两个类的示例(省略了导入语句):: "
245251
246252#: ../../howto/logging-cookbook.rst:388
247253msgid "which, when run, will produce:"
248- msgstr ""
254+ msgstr "在运行后会产生: "
249255
250256#: ../../howto/logging-cookbook.rst:394
251257msgid ""
@@ -258,6 +264,9 @@ msgid ""
258264"of each message with the handler's level, and only passes a message to a "
259265"handler if it's appropriate to do so."
260266msgstr ""
267+ "在Python 3.5之前,:class:`QueueListener` "
268+ "总是把从队列中接收的每个消息都传给它初始化的日志处理程序。(这是因为它会假设过滤级别总是在队列的另一侧去设置的。) 从Python "
269+ "3.5开始,可以通过在监听器构造函数中添加一个参数``respect_handler_level=True``改变这种情况。当这样设置时,监听器会比较每条消息的等级和日志处理器中设置的等级,只把需要传递的消息传给对应的日志处理器。"
261270
262271#: ../../howto/logging-cookbook.rst:407
263272msgid "Sending and receiving logging events across a network"
0 commit comments