1010# MuSheng Chen <[email protected] >, 201911111212# Freesand Leo <[email protected] >, 201913+ 1314#
1415#, fuzzy
1516msgid ""
@@ -18,7 +19,7 @@ msgstr ""
1819"Report-Msgid-Bugs-To : \n "
1920"POT-Creation-Date : 2019-09-01 14:24+0000\n "
2021"PO-Revision-Date : 2017-02-16 17:45+0000\n "
21- "Last-Translator : Freesand Leo <yuqinju @163.com>, 2019\n "
22+ "Last-Translator : 浩听 王 <wht_andrew @163.com>, 2019\n "
2223"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2324"MIME-Version : 1.0\n "
2425"Content-Type : text/plain; charset=UTF-8\n "
@@ -1400,28 +1401,28 @@ msgstr ""
14001401
14011402#: ../../howto/logging-cookbook.rst:2371
14021403msgid "When this script is run, the following output should be observed:"
1403- msgstr ""
1404+ msgstr "运行此脚本时,应看到以下输出: "
14041405
14051406#: ../../howto/logging-cookbook.rst:2401
14061407msgid ""
14071408"As you can see, actual logging output only occurs when an event is logged "
14081409"whose severity is ERROR or greater, but in that case, any previous events at"
14091410" lower severities are also logged."
1410- msgstr ""
1411+ msgstr "如你所见,实际日志记录输出仅在消息等级为ERROR或更高的事件时发生,但在这种情况下,任何之前较低消息等级的事件还会被记录。 "
14111412
14121413#: ../../howto/logging-cookbook.rst:2405
14131414msgid "You can of course use the conventional means of decoration::"
1414- msgstr ""
1415+ msgstr "你当然可以使用传统的装饰方法:: "
14151416
14161417#: ../../howto/logging-cookbook.rst:2415
14171418msgid "Formatting times using UTC (GMT) via configuration"
1418- msgstr ""
1419+ msgstr "通过配置使用UTC (GMT) 格式化时间 "
14191420
14201421#: ../../howto/logging-cookbook.rst:2417
14211422msgid ""
14221423"Sometimes you want to format times using UTC, which can be done using a "
14231424"class such as `UTCFormatter`, shown below::"
1424- msgstr ""
1425+ msgstr "有时候,你希望使用UTC来格式化时间,这可以使用一个类来完成,例如`UTCFormatter`,如下所示: "
14251426
14261427#: ../../howto/logging-cookbook.rst:2426
14271428msgid ""
@@ -1430,20 +1431,23 @@ msgid ""
14301431"can use the :func:`~logging.config.dictConfig` API with an approach "
14311432"illustrated by the following complete example::"
14321433msgstr ""
1434+ "然后你可以在你的代码中使用``UTCFormatter``,而不是:class:`~logging.Formatter`.。 "
1435+ "如果你想通过配置来实现这一功能,你可以使用:func:`~logging.config.dictConfig` API "
1436+ "来完成,该方法在以下完整示例中展示::"
14331437
14341438#: ../../howto/logging-cookbook.rst:2469
14351439msgid "When this script is run, it should print something like:"
1436- msgstr ""
1440+ msgstr "脚本会运行输出类似下面的内容: "
14371441
14381442#: ../../howto/logging-cookbook.rst:2476
14391443msgid ""
14401444"showing how the time is formatted both as local time and UTC, one for each "
14411445"handler."
1442- msgstr ""
1446+ msgstr "展示了如何将时间格式化为本地时间和UTC两种形式,其中每种形式对应一个日志处理器 。 "
14431447
14441448#: ../../howto/logging-cookbook.rst:2483
14451449msgid "Using a context manager for selective logging"
1446- msgstr ""
1450+ msgstr "使用上下文管理器进行选择性记录 "
14471451
14481452#: ../../howto/logging-cookbook.rst:2485
14491453msgid ""
@@ -1454,6 +1458,7 @@ msgid ""
14541458"optionally change the logging level and add a logging handler purely in the "
14551459"scope of the context manager::"
14561460msgstr ""
1461+ "有时候,我们需要暂时更改日志配置,并在执行某些操作后将其还原。为此,上下文管理器是实现保存和恢复日志上下文的最明显的方式。这是一个关于上下文管理器的简单例子,它允许你在上下文管理器的作用域内更改日志等级以及增加日志句柄:"
14571462
14581463#: ../../howto/logging-cookbook.rst:2518
14591464msgid ""
@@ -1463,12 +1468,15 @@ msgid ""
14631468" from the block. You can also ask the manager to close the handler for you "
14641469"on block exit - you could do this if you don't need the handler any more."
14651470msgstr ""
1471+ "如果指定上下文管理器的日志记录等级属性,则在上下文管理器的with语句所涵盖的代码中,日志记录器的记录等级将临时设置为上下文管理器所配置的日志记录等级。"
1472+ " 如果指定上下文管理的句柄属性,则该句柄在进入上下文管理器的上下文时添加到记录器中,并在退出时被删除。 "
1473+ "如果你再也不需要该句柄时,你可以让上下文管理器在退出上下文管理器的上下文时关闭它。"
14661474
14671475#: ../../howto/logging-cookbook.rst:2524
14681476msgid ""
14691477"To illustrate how it works, we can add the following block of code to the "
14701478"above::"
1471- msgstr ""
1479+ msgstr "为了说明它是如何工作的,我们可以在上面添加以下代码块:: "
14721480
14731481#: ../../howto/logging-cookbook.rst:2542
14741482msgid ""
@@ -1483,33 +1491,35 @@ msgid ""
14831491"#6 appears (like message #1) whereas message #7 doesn't (just like message "
14841492"#2)."
14851493msgstr ""
1494+ "我们最初设置日志记录器的消息等级为``INFO``,因此消息#1出现,消息#2没有出现。在接下来的`with``代码块中我们暂时将消息等级变更为``DEBUG``,从而消息#3出现。在这一代码块退出后,日志记录器的消息等级恢复为``INFO``,从而消息#4没有出现。在下一个``with``代码块中,我们再一次将设置消息等级设置为``DEBUG``,同时添加一个将消息写入``sys.stdout``的日志处理器。因此,消息#5在控制台出现两次(分别通过``stderr``和``stdout``)。在``with``语句完成后,状态与之前一样,因此消息#6出现(类似消息#1),而消息#7没有出现(类似消息#2)。"
14861495
14871496#: ../../howto/logging-cookbook.rst:2552
14881497msgid "If we run the resulting script, the result is as follows:"
1489- msgstr ""
1498+ msgstr "如果我们运行生成的脚本,结果如下: "
14901499
14911500#: ../../howto/logging-cookbook.rst:2563
14921501msgid ""
14931502"If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the "
14941503"following, which is the only message written to ``stdout``:"
14951504msgstr ""
1505+ "我们将stderr标准错误传输到/dev/null,我再次运行生成的脚步,唯一被写入stdout标准输出的消息,即我们所能看见的消息,如下:"
14961506
14971507#: ../../howto/logging-cookbook.rst:2571
14981508msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:"
1499- msgstr ""
1509+ msgstr "再一次,将``stdout``标准输出重定向到``/dev/null``,我获得如下结果: "
15001510
15011511#: ../../howto/logging-cookbook.rst:2581
15021512msgid ""
15031513"In this case, the message #5 printed to ``stdout`` doesn't appear, as "
15041514"expected."
1505- msgstr ""
1515+ msgstr "在这种情况下,与预期一致,打印到``stdout``标准输出的消息#5不会出现。 "
15061516
15071517#: ../../howto/logging-cookbook.rst:2583
15081518msgid ""
15091519"Of course, the approach described here can be generalised, for example to "
15101520"attach logging filters temporarily. Note that the above code works in Python"
15111521" 2 as well as Python 3."
1512- msgstr ""
1522+ msgstr "当然,这里描述的方法可以概括,例如临时附加日志记录过滤器。 请注意,上面的代码适用于Python 2以及Python 3。 "
15131523
15141524#: ../../howto/logging-cookbook.rst:2591
15151525msgid "A CLI application starter template"
0 commit comments