55#
66# Translators:
77# ww song <[email protected] >, 20198- # Freesand Leo <[email protected] >, 2019981091110# MuSheng Chen <[email protected] >, 201912111312# Shengjing Zhu <[email protected] >, 20191413# Meng Du <[email protected] >, 20201514# Dai Xu <[email protected] >, 202115+ # Freesand Leo <[email protected] >, 20211616#
1717#, fuzzy
1818msgid ""
@@ -21,7 +21,7 @@ msgstr ""
2121"Report-Msgid-Bugs-To : \n "
2222"POT-Creation-Date : 2021-01-01 16:02+0000\n "
2323"PO-Revision-Date : 2019-09-01 03:37+0000\n "
24- "Last-Translator : Dai Xu <daixu61@hotmail .com>, 2021\n "
24+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2021\n "
2525"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2626"MIME-Version : 1.0\n "
2727"Content-Type : text/plain; charset=UTF-8\n "
@@ -781,13 +781,17 @@ msgid ""
781781":meth:`Logger.makeRecord`, and set it using :func:`~logging.setLoggerClass` "
782782"before any loggers that you care about are instantiated."
783783msgstr ""
784+ "创建 :class:`Logger` 自定义子类,重写 :meth:`Logger.makeRecord`,并在实例化所需日志对象之前用 "
785+ ":func:`~logging.setLoggerClass` 进行设置。"
784786
785787#: ../../howto/logging-cookbook.rst:1241
786788msgid ""
787789"Add a :class:`Filter` to a logger or handler, which does the necessary "
788790"special manipulation you need when its :meth:`~Filter.filter` method is "
789791"called."
790792msgstr ""
793+ "为日志对象添加 :class:`Filter` 或 handler,当其 :meth:`~Filter.filter` "
794+ "方法被调用时,会执行必要的定制操作。"
791795
792796#: ../../howto/logging-cookbook.rst:1245
793797msgid ""
@@ -796,6 +800,8 @@ msgid ""
796800"attempt to set its own :class:`Logger` subclass, and the one which did this "
797801"last would win."
798802msgstr ""
803+ "比如说在有多个不同库要完成不同操作的场景下,第一种方式会有点笨拙。 每次都要尝试设置自己的 :class:`Logger` "
804+ "子类,而起作用的是最后一次尝试。"
799805
800806#: ../../howto/logging-cookbook.rst:1250
801807msgid ""
@@ -805,6 +811,8 @@ msgid ""
805811"to remember to do this every time they introduced a new logger (which they "
806812"would do simply by adding new packages or modules and doing ::"
807813msgstr ""
814+ "第二种方式在多数情况下效果都比较良好,但不允许你使用特殊化的 :class:`LogRecord` 子类。 "
815+ "库开发者可以为他们的日志记录器设置合适的过滤器,但他们应当要记得每次引入新的日志记录器时都需如此(他们只需通过添加新的包或模块并执行以下操作即可)::"
808816
809817#: ../../howto/logging-cookbook.rst:1258
810818msgid ""
@@ -815,6 +823,9 @@ msgid ""
815823" so output from that handler would not reflect the intentions of the library"
816824" developer."
817825msgstr ""
826+ "或许这样要顾及太多事情。开发人员还可以将过滤器附加到其顶级日志对象的 :class:`~logging.NullHandler` "
827+ "中,但如果应用程序开发人员将 handler 附加到较底层库的日志对象,则不会调用该过滤器 --- 所以 handler "
828+ "输出的内容不会符合库开发人员的预期。 "
818829
819830#: ../../howto/logging-cookbook.rst:1264
820831msgid ""
@@ -825,6 +836,11 @@ msgid ""
825836"signature as the :class:`~logging.LogRecord` constructor, as "
826837":class:`LogRecord` is the default setting for the factory."
827838msgstr ""
839+ "在 Python 3.2 以上版本中,:class:`~logging.LogRecord` "
840+ "的创建是通过工厂对象完成的,工厂对象可以指定。工厂对象只是一个可调用对象,可以用 "
841+ ":func:`~logging.setLogRecordFactory` 进行设置,并用 "
842+ ":func:`~logging.getLogRecordFactory` 进行查询。工厂对象的调用参数与 "
843+ ":class:`~logging.LogRecord` 的构造函数相同,因为 :class:`LogRecord` 是工厂对象的默认设置。"
828844
829845#: ../../howto/logging-cookbook.rst:1271
830846msgid ""
@@ -833,6 +849,7 @@ msgid ""
833849"additional attributes to the record once created, using a pattern similar to"
834850" this::"
835851msgstr ""
852+ "这种方式可以让自定义工厂对象完全控制 LogRecord 的创建过程。比如可以返回一个子类,或者在创建的日志对象中加入一些额外的属性,使用方式如下所示:"
836853
837854#: ../../howto/logging-cookbook.rst:1284
838855msgid ""
@@ -843,34 +860,40 @@ msgid ""
843860"time overhead to all logging operations, and the technique should only be "
844861"used when the use of a :class:`Filter` does not provide the desired result."
845862msgstr ""
863+ "这种模式允许不同的库将多个工厂对象链在一起,只要不会覆盖彼此的属性或标准属性,就不会出现意外。但应记住,工厂链中的每个节点都会增加日志操作的运行开销,本技术仅在采用"
864+ " :class:`Filter` 无法达到目标时才应使用。 "
846865
847866#: ../../howto/logging-cookbook.rst:1295
848867msgid "Subclassing QueueHandler - a ZeroMQ example"
849- msgstr ""
868+ msgstr "子类化 QueueHandler - ZeroMQ 示例 "
850869
851870#: ../../howto/logging-cookbook.rst:1297
852871msgid ""
853872"You can use a :class:`QueueHandler` subclass to send messages to other kinds"
854873" of queues, for example a ZeroMQ 'publish' socket. In the example below,the "
855874"socket is created separately and passed to the handler (as its 'queue')::"
856875msgstr ""
876+ "你可以使用 :class:`QueueHandler` 子类将消息发送给其他类型的队列 ,比如 ZeroMQ 'publish' 套接字。 "
877+ "在以下示例中,套接字将单独创建并传给处理句柄 (作为它的 'queue')::"
857878
858879#: ../../howto/logging-cookbook.rst:1316
859880msgid ""
860881"Of course there are other ways of organizing this, for example passing in "
861882"the data needed by the handler to create the socket::"
862- msgstr ""
883+ msgstr "当然还有其他方案,比如通过 hander 传入所需数据,以创建 socket: "
863884
864885#: ../../howto/logging-cookbook.rst:1334
865886msgid "Subclassing QueueListener - a ZeroMQ example"
866- msgstr ""
887+ msgstr "子类化 QueueListener —— ZeroMQ 示例 "
867888
868889#: ../../howto/logging-cookbook.rst:1336
869890msgid ""
870891"You can also subclass :class:`QueueListener` to get messages from other "
871892"kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an "
872893"example::"
873894msgstr ""
895+ "你还可以子类化 :class:`QueueListener` 来从其他类型的队列中获取消息,比如从 ZeroMQ 'subscribe' 套接字。 "
896+ "下面是一个例子::"
874897
875898#: ../../howto/logging-cookbook.rst:1355
876899msgid "Module :mod:`logging`"
@@ -898,15 +921,15 @@ msgstr "日志记录模块附带的有用处理程序。"
898921
899922#: ../../howto/logging-cookbook.rst:1363
900923msgid ":ref:`A basic logging tutorial <logging-basic-tutorial>`"
901- msgstr ""
924+ msgstr ":ref:`日志操作基础教程 <logging-basic-tutorial>` "
902925
903926#: ../../howto/logging-cookbook.rst:1365
904927msgid ":ref:`A more advanced logging tutorial <logging-advanced-tutorial>`"
905- msgstr ""
928+ msgstr ":ref:`日志操作的高级教程 <logging-advanced-tutorial>` "
906929
907930#: ../../howto/logging-cookbook.rst:1369
908931msgid "An example dictionary-based configuration"
909- msgstr ""
932+ msgstr "基于字典进行日志配置的示例 "
910933
911934#: ../../howto/logging-cookbook.rst:1371
912935msgid ""
@@ -926,32 +949,32 @@ msgstr ""
926949
927950#: ../../howto/logging-cookbook.rst:1434
928951msgid "Using a rotator and namer to customize log rotation processing"
929- msgstr ""
952+ msgstr "利用 rotator 和 namer 自定义日志轮换操作 "
930953
931954#: ../../howto/logging-cookbook.rst:1436
932955msgid ""
933956"An example of how you can define a namer and rotator is given in the "
934957"following snippet, which shows zlib-based compression of the log file::"
935- msgstr ""
958+ msgstr "以下代码给出了定义 namer 和 rotator 的示例,其中演示了基于 zlib 的日志文件压缩过程: "
936959
937960#: ../../howto/logging-cookbook.rst:1454
938961msgid ""
939962"These are not \" true\" .gz files, as they are bare compressed data, with no "
940963"\" container\" such as you’d find in an actual gzip file. This snippet is "
941964"just for illustration purposes."
942- msgstr ""
965+ msgstr "这些不是“真正的” .gz 文件,因为他们只是纯压缩数据,缺少真正 gzip 文件中的“容器”。此段代码只是用于演示。 "
943966
944967#: ../../howto/logging-cookbook.rst:1459
945968msgid "A more elaborate multiprocessing example"
946- msgstr ""
969+ msgstr "更加详细的多道处理示例 "
947970
948971#: ../../howto/logging-cookbook.rst:1461
949972msgid ""
950973"The following working example shows how logging can be used with "
951974"multiprocessing using configuration files. The configurations are fairly "
952975"simple, but serve to illustrate how more complex ones could be implemented "
953976"in a real multiprocessing scenario."
954- msgstr ""
977+ msgstr "以下可运行的示例显示了如何利用配置文件在多进程中应用日志。这些配置相当简单,但足以说明如何在真实的多进程场景中实现较为复杂的配置。 "
955978
956979#: ../../howto/logging-cookbook.rst:1466
957980msgid ""
@@ -965,16 +988,19 @@ msgid ""
965988" purely illustrative, but you should be able to adapt this example to your "
966989"own scenario."
967990msgstr ""
991+ "上述示例中,主进程产生一个侦听器进程和一些工作进程。每个主进程、侦听器进程和工作进程都有三种独立的日志配置(工作进程共享同一套配置)。大家可以看到主进程的日志记录过程、工作线程向"
992+ " QueueHandler 写入日志的过程,以及侦听器实现 QueueListener 和较为复杂的日志配置,如何将由队列接收到的事件分发给配置指定的 "
993+ "handler。请注意,这些配置纯粹用于演示,但应该能调整代码以适用于自己的场景。"
968994
969995#: ../../howto/logging-cookbook.rst:1476
970996msgid ""
971997"Here's the script - the docstrings and the comments hopefully explain how it"
972998" works::"
973- msgstr ""
999+ msgstr "以下是代码——但愿文档字符串和注释能有助于理解其工作原理: "
9741000
9751001#: ../../howto/logging-cookbook.rst:1688
9761002msgid "Inserting a BOM into messages sent to a SysLogHandler"
977- msgstr ""
1003+ msgstr "在发送给 SysLogHandler 的信息中插入一个 BOM。 "
9781004
9791005#: ../../howto/logging-cookbook.rst:1690
9801006msgid ""
0 commit comments