@@ -890,60 +890,62 @@ msgstr "配置日志记录"
890890
891891#: ../../howto/logging.rst:578
892892msgid "Programmers can configure logging in three ways:"
893- msgstr ""
893+ msgstr "开发者可以通过三种方式配置日志记录: "
894894
895895#: ../../howto/logging.rst:580
896896msgid ""
897897"Creating loggers, handlers, and formatters explicitly using Python code that"
898898" calls the configuration methods listed above."
899- msgstr ""
899+ msgstr "使用调用上面列出的配置方法的 Python 代码显式创建记录器、处理程序和格式化程序。 "
900900
901901#: ../../howto/logging.rst:582
902902msgid ""
903903"Creating a logging config file and reading it using the :func:`fileConfig` "
904904"function."
905- msgstr ""
905+ msgstr "创建日志配置文件并使用 :func:`fileConfig` 函数读取它。 "
906906
907907#: ../../howto/logging.rst:584
908908msgid ""
909909"Creating a dictionary of configuration information and passing it to the "
910910":func:`dictConfig` function."
911- msgstr ""
911+ msgstr "创建配置信息字典并将其传递给 :func:`dictConfig` 函数。 "
912912
913913#: ../../howto/logging.rst:587
914914msgid ""
915915"For the reference documentation on the last two options, see :ref:`logging-"
916916"config-api`. The following example configures a very simple logger, a "
917917"console handler, and a simple formatter using Python code::"
918918msgstr ""
919+ "有关最后两个选项的参考文档,请参阅 :ref:`logging-config-api` 。 以下示例使用 Python "
920+ "代码配置一个非常简单的记录器/一个控制台处理程序和一个简单的格式化程序::"
919921
920922#: ../../howto/logging.rst:617
921923msgid ""
922924"Running this module from the command line produces the following output:"
923- msgstr ""
925+ msgstr "从命令行运行此模块将生成以下输出: "
924926
925927#: ../../howto/logging.rst:628
926928msgid ""
927929"The following Python module creates a logger, handler, and formatter nearly "
928930"identical to those in the example listed above, with the only difference "
929931"being the names of the objects::"
930- msgstr ""
932+ msgstr "以下 Python 模块创建的记录器、处理程序和格式化程序几乎与上面列出的示例中的相同,唯一的区别是对象的名称:: "
931933
932934#: ../../howto/logging.rst:647
933935msgid "Here is the logging.conf file:"
934- msgstr ""
936+ msgstr "这是 logging.conf 文件: "
935937
936938#: ../../howto/logging.rst:680
937939msgid ""
938940"The output is nearly identical to that of the non-config-file-based example:"
939- msgstr ""
941+ msgstr "输出几乎与不基于配置文件的示例相同: "
940942
941943#: ../../howto/logging.rst:691
942944msgid ""
943945"You can see that the config file approach has a few advantages over the "
944946"Python code approach, mainly separation of configuration and code and the "
945947"ability of noncoders to easily modify the logging properties."
946- msgstr ""
948+ msgstr "你可以看到配置文件方法比 Python 代码方法有一些优势,主要是配置和代码的分离以及非开发者轻松修改日志记录属性的能力。 "
947949
948950#: ../../howto/logging.rst:695
949951msgid ""
@@ -955,6 +957,10 @@ msgid ""
955957"configuration. Please refer to the reference documentation for more "
956958"information, and specify ``False`` for this parameter if you wish."
957959msgstr ""
960+ ":func:`fileConfig` 函数接受一个默认参数 ``disable_existing_loggers`` ,出于向后兼容的原因,默认为 "
961+ "``True`` 。这可能是你想要的,也可能不是你想要的,因为除非在配置中明确命名它们(或一个上级节点中),否则它将导致在 "
962+ ":func:`fileConfig` 调用之前存在的任何非 root 记录器被禁用。有关更多信息,请参阅参考文档,如果需要,请为此参数指定 "
963+ "``False`` 。"
958964
959965#: ../../howto/logging.rst:703
960966msgid ""
@@ -964,6 +970,9 @@ msgid ""
964970"to the logger-disabling behaviour described above, which may not be what you"
965971" want - in which case, provide the key explicitly with a value of ``False``."
966972msgstr ""
973+ "传递给 :func:`dictConfig` 的字典也可以用键 ``disable_existing_loggers`` "
974+ "指定一个布尔值,如果没有在字典中明确指定,也默认被解释为 ``True`` "
975+ "。这会导致上面描述的记录器禁用行为,这可能不是你想要的——在这种情况下,明确地为键提供 ``False`` 值。"
967976
968977#: ../../howto/logging.rst:713
969978msgid ""
@@ -975,6 +984,10 @@ msgid ""
975984"``mypackage`` and module ``mymodule``, where ``mypackage`` is available on "
976985"the Python import path)."
977986msgstr ""
987+ "请注意,配置文件中引用的类名称需要相对于日志记录模块,或者可以使用常规导入机制解析的绝对值。因此,你可以使用 "
988+ ":class:`~logging.handlers.WatchedFileHandler` (相对于日志记录模块)或 "
989+ "``mypackage.mymodule.MyHandler`` (对于在 ``mypackage`` 包中定义的类和模块 ``mymodule`` "
990+ ",其中 ``mypackage`` 在Python导入路径上可用)。"
978991
979992#: ../../howto/logging.rst:721
980993msgid ""
@@ -990,22 +1003,27 @@ msgid ""
9901003"you can construct the dictionary in Python code, receive it in pickled form "
9911004"over a socket, or use whatever approach makes sense for your application."
9921005msgstr ""
1006+ "在 Python 3.2 中,引入了一种新的配置日志记录的方法,使用字典来保存配置信息。 "
1007+ "这提供了上述基于配置文件方法的功能的超集,并且是新应用程序和部署的推荐配置方法。 因为 Python "
1008+ "字典用于保存配置信息,并且由于你可以使用不同的方式填充该字典,因此你有更多的配置选项。 例如,你可以使用 JSON 格式的配置文件,或者如果你有权访问 "
1009+ "YAML 处理功能,则可以使用 YAML 格式的文件来填充配置字典。当然,你可以在 Python 代码中构造字典,通过套接字以 pickle "
1010+ "形式接收它,或者使用对你的应用程序合理的任何方法。"
9931011
9941012#: ../../howto/logging.rst:733
9951013msgid ""
9961014"Here's an example of the same configuration as above, in YAML format for the"
9971015" new dictionary-based approach:"
998- msgstr ""
1016+ msgstr "以下是与上述相同配置的示例,采用 YAML 格式,用于新的基于字典的方法: "
9991017
10001018#: ../../howto/logging.rst:757
10011019msgid ""
10021020"For more information about logging using a dictionary, see :ref:`logging-"
10031021"config-api`."
1004- msgstr ""
1022+ msgstr "有关使用字典进行日志记录的更多信息,请参阅 :ref:`logging-config-api` 。 "
10051023
10061024#: ../../howto/logging.rst:761
10071025msgid "What happens if no configuration is provided"
1008- msgstr ""
1026+ msgstr "如果没有提供配置会发生什么 "
10091027
10101028#: ../../howto/logging.rst:763
10111029msgid ""
@@ -1014,26 +1032,29 @@ msgid ""
10141032"output the event. The behaviour of the logging package in these "
10151033"circumstances is dependent on the Python version."
10161034msgstr ""
1035+ "如果未提供日志记录配置,则可能出现需要输出日志记录事件但无法找到输出事件的处理程序的情况。 在这些情况下,日志包的行为取决于 Python 版本。"
10171036
10181037#: ../../howto/logging.rst:768
10191038msgid "For versions of Python prior to 3.2, the behaviour is as follows:"
1020- msgstr ""
1039+ msgstr "对于3.2之前的Python版本,行为如下: "
10211040
10221041#: ../../howto/logging.rst:770
10231042msgid ""
10241043"If *logging.raiseExceptions* is ``False`` (production mode), the event is "
10251044"silently dropped."
1026- msgstr ""
1045+ msgstr "如果 *logging.raiseExceptions* 为 ``False`` (生产模式),则会以静默方式丢弃该事件。 "
10271046
10281047#: ../../howto/logging.rst:773
10291048msgid ""
10301049"If *logging.raiseExceptions* is ``True`` (development mode), a message 'No "
10311050"handlers could be found for logger X.Y.Z' is printed once."
10321051msgstr ""
1052+ "如果 *logging.raiseExceptions* 为 ``True`` (开发模式),则会打印一条消息“无法找到记录器 X.Y.Z "
1053+ "的处理程序”。"
10331054
10341055#: ../../howto/logging.rst:776
10351056msgid "In Python 3.2 and later, the behaviour is as follows:"
1036- msgstr ""
1057+ msgstr "在 Python 3.2 及更高版本中,行为如下: "
10371058
10381059#: ../../howto/logging.rst:778
10391060msgid ""
@@ -1129,31 +1150,31 @@ msgstr ""
11291150
11301151#: ../../howto/logging.rst:848
11311152msgid "50"
1132- msgstr ""
1153+ msgstr "50 "
11331154
11341155#: ../../howto/logging.rst:850
11351156msgid "40"
1136- msgstr ""
1157+ msgstr "40 "
11371158
11381159#: ../../howto/logging.rst:852
11391160msgid "30"
1140- msgstr ""
1161+ msgstr "30 "
11411162
11421163#: ../../howto/logging.rst:854
11431164msgid "20"
1144- msgstr ""
1165+ msgstr "20 "
11451166
11461167#: ../../howto/logging.rst:856
11471168msgid "10"
1148- msgstr ""
1169+ msgstr "10 "
11491170
11501171#: ../../howto/logging.rst:858
11511172msgid "``NOTSET``"
1152- msgstr ""
1173+ msgstr "``NOTSET`` "
11531174
11541175#: ../../howto/logging.rst:858
11551176msgid "0"
1156- msgstr ""
1177+ msgstr "0 "
11571178
11581179#: ../../howto/logging.rst:861
11591180msgid ""
@@ -1508,28 +1529,28 @@ msgstr ""
15081529
15091530#: ../../howto/logging.rst:1095
15101531msgid "Module :mod:`logging`"
1511- msgstr ""
1532+ msgstr "模块 :mod:`logging` "
15121533
15131534#: ../../howto/logging.rst:1095
15141535msgid "API reference for the logging module."
15151536msgstr ""
15161537
15171538#: ../../howto/logging.rst:1098
15181539msgid "Module :mod:`logging.config`"
1519- msgstr ""
1540+ msgstr "模块 :mod:`logging.config` "
15201541
15211542#: ../../howto/logging.rst:1098
15221543msgid "Configuration API for the logging module."
15231544msgstr ""
15241545
15251546#: ../../howto/logging.rst:1101
15261547msgid "Module :mod:`logging.handlers`"
1527- msgstr ""
1548+ msgstr "模块 :mod:`logging.handlers` "
15281549
15291550#: ../../howto/logging.rst:1101
15301551msgid "Useful handlers included with the logging module."
15311552msgstr ""
15321553
15331554#: ../../howto/logging.rst:1103
15341555msgid ":ref:`A logging cookbook <logging-cookbook>`"
1535- msgstr ""
1556+ msgstr ":ref:`A logging cookbook <logging-cookbook>` "
0 commit comments