10101111# Shengjing Zhu <[email protected] >, 20191212# Meng Du <[email protected] >, 202013- # Freesand Leo <[email protected] >, 20211413# Dai Xu <[email protected] >, 202114+ # Freesand Leo <[email protected] >, 20211515#
1616#, fuzzy
1717msgid ""
@@ -20,7 +20,7 @@ msgstr ""
2020"Report-Msgid-Bugs-To : \n "
2121"POT-Creation-Date : 2021-01-01 05:02+0000\n "
2222"PO-Revision-Date : 2017-02-16 17:45+0000\n "
23- "Last-Translator : Dai Xu <daixu61@hotmail .com>, 2021\n "
23+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2021\n "
2424"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2525"MIME-Version : 1.0\n "
2626"Content-Type : text/plain; charset=UTF-8\n "
@@ -793,6 +793,8 @@ msgid ""
793793"special manipulation you need when its :meth:`~Filter.filter` method is "
794794"called."
795795msgstr ""
796+ "为日志对象添加 :class:`Filter` 或 handler,当其 :meth:`~Filter.filter` "
797+ "方法被调用时,会执行必要的定制操作。"
796798
797799#: ../../howto/logging-cookbook.rst:1244
798800msgid ""
@@ -801,6 +803,8 @@ msgid ""
801803"attempt to set its own :class:`Logger` subclass, and the one which did this "
802804"last would win."
803805msgstr ""
806+ "比如说在有多个不同库要完成不同操作的场景下,第一种方式会有点笨拙。 每次都要尝试设置自己的 :class:`Logger` "
807+ "子类,而起作用的是最后一次尝试。"
804808
805809#: ../../howto/logging-cookbook.rst:1249
806810msgid ""
@@ -810,6 +814,8 @@ msgid ""
810814"to remember to do this every time they introduced a new logger (which they "
811815"would do simply by adding new packages or modules and doing ::"
812816msgstr ""
817+ "第二种方式在多数情况下效果都比较良好,但不允许你使用特殊化的 :class:`LogRecord` 子类。 "
818+ "库开发者可以为他们的日志记录器设置合适的过滤器,但他们应当要记得每次引入新的日志记录器时都需如此(他们只需通过添加新的包或模块并执行以下操作即可)::"
813819
814820#: ../../howto/logging-cookbook.rst:1257
815821msgid ""
@@ -820,6 +826,9 @@ msgid ""
820826" so output from that handler would not reflect the intentions of the library"
821827" developer."
822828msgstr ""
829+ "或许这样要顾及太多事情。开发人员还可以将过滤器附加到其顶级日志对象的 :class:`~logging.NullHandler` "
830+ "中,但如果应用程序开发人员将 handler 附加到较底层库的日志对象,则不会调用该过滤器 --- 所以 handler "
831+ "输出的内容不会符合库开发人员的预期。 "
823832
824833#: ../../howto/logging-cookbook.rst:1263
825834msgid ""
@@ -830,6 +839,11 @@ msgid ""
830839"signature as the :class:`~logging.LogRecord` constructor, as "
831840":class:`LogRecord` is the default setting for the factory."
832841msgstr ""
842+ "在 Python 3.2 以上版本中,:class:`~logging.LogRecord` "
843+ "的创建是通过工厂对象完成的,工厂对象可以指定。工厂对象只是一个可调用对象,可以用 "
844+ ":func:`~logging.setLogRecordFactory` 进行设置,并用 "
845+ ":func:`~logging.getLogRecordFactory` 进行查询。工厂对象的调用参数与 "
846+ ":class:`~logging.LogRecord` 的构造函数相同,因为 :class:`LogRecord` 是工厂对象的默认设置。"
833847
834848#: ../../howto/logging-cookbook.rst:1270
835849msgid ""
@@ -838,6 +852,7 @@ msgid ""
838852"additional attributes to the record once created, using a pattern similar to"
839853" this::"
840854msgstr ""
855+ "这种方式可以让自定义工厂对象完全控制 LogRecord 的创建过程。比如可以返回一个子类,或者在创建的日志对象中加入一些额外的属性,使用方式如下所示:"
841856
842857#: ../../howto/logging-cookbook.rst:1283
843858msgid ""
@@ -848,34 +863,40 @@ msgid ""
848863"time overhead to all logging operations, and the technique should only be "
849864"used when the use of a :class:`Filter` does not provide the desired result."
850865msgstr ""
866+ "这种模式允许不同的库将多个工厂对象链在一起,只要不会覆盖彼此的属性或标准属性,就不会出现意外。但应记住,工厂链中的每个节点都会增加日志操作的运行开销,本技术仅在采用"
867+ " :class:`Filter` 无法达到目标时才应使用。 "
851868
852869#: ../../howto/logging-cookbook.rst:1294
853870msgid "Subclassing QueueHandler - a ZeroMQ example"
854- msgstr ""
871+ msgstr "子类化 QueueHandler - ZeroMQ 示例 "
855872
856873#: ../../howto/logging-cookbook.rst:1296
857874msgid ""
858875"You can use a :class:`QueueHandler` subclass to send messages to other kinds"
859876" of queues, for example a ZeroMQ 'publish' socket. In the example below,the "
860877"socket is created separately and passed to the handler (as its 'queue')::"
861878msgstr ""
879+ "你可以使用 :class:`QueueHandler` 子类将消息发送给其他类型的队列 ,比如 ZeroMQ 'publish' 套接字。 "
880+ "在以下示例中,套接字将单独创建并传给处理句柄 (作为它的 'queue')::"
862881
863882#: ../../howto/logging-cookbook.rst:1315
864883msgid ""
865884"Of course there are other ways of organizing this, for example passing in "
866885"the data needed by the handler to create the socket::"
867- msgstr ""
886+ msgstr "当然还有其他方案,比如通过 hander 传入所需数据,以创建 socket: "
868887
869888#: ../../howto/logging-cookbook.rst:1333
870889msgid "Subclassing QueueListener - a ZeroMQ example"
871- msgstr ""
890+ msgstr "子类化 QueueListener —— ZeroMQ 示例 "
872891
873892#: ../../howto/logging-cookbook.rst:1335
874893msgid ""
875894"You can also subclass :class:`QueueListener` to get messages from other "
876895"kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an "
877896"example::"
878897msgstr ""
898+ "你还可以子类化 :class:`QueueListener` 来从其他类型的队列中获取消息,比如从 ZeroMQ 'subscribe' 套接字。 "
899+ "下面是一个例子::"
879900
880901#: ../../howto/logging-cookbook.rst:1354
881902msgid "Module :mod:`logging`"
@@ -899,19 +920,19 @@ msgstr "模块 :mod:`logging.handlers`"
899920
900921#: ../../howto/logging-cookbook.rst:1360
901922msgid "Useful handlers included with the logging module."
902- msgstr "日志记录模块附带的有用处理程序 。"
923+ msgstr "日志记录模块中的常用 handler 。"
903924
904925#: ../../howto/logging-cookbook.rst:1362
905926msgid ":ref:`A basic logging tutorial <logging-basic-tutorial>`"
906- msgstr ""
927+ msgstr ":ref:`日志操作基础教程 <logging-basic-tutorial>` "
907928
908929#: ../../howto/logging-cookbook.rst:1364
909930msgid ":ref:`A more advanced logging tutorial <logging-advanced-tutorial>`"
910- msgstr ""
931+ msgstr ":ref:`日志操作的高级教程 <logging-advanced-tutorial>` "
911932
912933#: ../../howto/logging-cookbook.rst:1368
913934msgid "An example dictionary-based configuration"
914- msgstr ""
935+ msgstr "基于字典进行日志配置的示例 "
915936
916937#: ../../howto/logging-cookbook.rst:1370
917938msgid ""
@@ -921,42 +942,48 @@ msgid ""
921942"logging>`_. This dictionary is passed to :func:`~config.dictConfig` to put "
922943"the configuration into effect::"
923944msgstr ""
945+ "以下是日志配置字典的一个示例——它取自 Django "
946+ "项目的`文档<https://docs.djangoproject.com/en/stable/topics/logging/#configuring-"
947+ "logging>`_。此字典将被传给 :func:`~config.dictConfig` 以使配置生效:"
924948
925949#: ../../howto/logging-cookbook.rst:1426
926950msgid ""
927951"For more information about this configuration, you can see the `relevant "
928952"section <https://docs.djangoproject.com/en/stable/topics/logging"
929953"/#configuring-logging>`_ of the Django documentation."
930954msgstr ""
955+ "有关本配置的更多信息,请参阅 Django 文档的 `有关章节 "
956+ "<https://docs.djangoproject.com/en/stable/topics/logging/#configuring-"
957+ "logging>`_ 。"
931958
932959#: ../../howto/logging-cookbook.rst:1433
933960msgid "Using a rotator and namer to customize log rotation processing"
934- msgstr ""
961+ msgstr "利用 rotator 和 namer 自定义日志轮换操作 "
935962
936963#: ../../howto/logging-cookbook.rst:1435
937964msgid ""
938965"An example of how you can define a namer and rotator is given in the "
939966"following snippet, which shows zlib-based compression of the log file::"
940- msgstr ""
967+ msgstr "以下代码给出了定义 namer 和 rotator 的示例,其中演示了基于 zlib 的日志文件压缩过程: "
941968
942969#: ../../howto/logging-cookbook.rst:1453
943970msgid ""
944971"These are not \" true\" .gz files, as they are bare compressed data, with no "
945972"\" container\" such as you’d find in an actual gzip file. This snippet is "
946973"just for illustration purposes."
947- msgstr ""
974+ msgstr "这些不是“真正的” .gz 文件,因为他们只是纯压缩数据,缺少真正 gzip 文件中的“容器”。此段代码只是用于演示。 "
948975
949976#: ../../howto/logging-cookbook.rst:1458
950977msgid "A more elaborate multiprocessing example"
951- msgstr ""
978+ msgstr "更详细的多进程日志示例 "
952979
953980#: ../../howto/logging-cookbook.rst:1460
954981msgid ""
955982"The following working example shows how logging can be used with "
956983"multiprocessing using configuration files. The configurations are fairly "
957984"simple, but serve to illustrate how more complex ones could be implemented "
958985"in a real multiprocessing scenario."
959- msgstr ""
986+ msgstr "以下可运行的示例显示了如何利用配置文件在多进程中应用日志。这些配置相当简单,但足以说明如何在真实的多进程场景中实现较为复杂的配置。 "
960987
961988#: ../../howto/logging-cookbook.rst:1465
962989msgid ""
@@ -970,16 +997,19 @@ msgid ""
970997" purely illustrative, but you should be able to adapt this example to your "
971998"own scenario."
972999msgstr ""
1000+ "在此示例中,主进程产生一个侦听器进程和一些工作进程。每个主进程、侦听器进程和工作进程都有三种独立的日志配置(工作进程共享同一套配置)。大家可以看到主进程的日志记录过程、工作线程向"
1001+ " QueueHandler 写入日志的过程,以及侦听器实现 QueueListener 和较为复杂的日志配置,如何将由队列接收到的事件分发给配置指定的 "
1002+ "handler。请注意,这些配置纯粹用于演示,但应该能调整代码以适用于自己的场景。"
9731003
9741004#: ../../howto/logging-cookbook.rst:1475
9751005msgid ""
9761006"Here's the script - the docstrings and the comments hopefully explain how it"
9771007" works::"
978- msgstr ""
1008+ msgstr "以下是代码——但愿文档字符串和注释能有助于理解其工作原理: "
9791009
9801010#: ../../howto/logging-cookbook.rst:1687
9811011msgid "Inserting a BOM into messages sent to a SysLogHandler"
982- msgstr ""
1012+ msgstr "在发送给 SysLogHandler 的信息中插入一个 BOM。 "
9831013
9841014#: ../../howto/logging-cookbook.rst:1689
9851015msgid ""
0 commit comments