Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 644d2c4

Browse files
[po] auto sync
1 parent 34d496e commit 644d2c4

4 files changed

Lines changed: 7015 additions & 6955 deletions

File tree

howto/logging-cookbook.po

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# 非法操作 <[email protected]>, 2019
1010
# 浩听 王 <[email protected]>, 2019
1111
# Meng Du <[email protected]>, 2020
12-
# Freesand Leo <[email protected]>, 2021
1312
# Dai Xu <[email protected]>, 2021
13+
# Freesand Leo <[email protected]>, 2021
1414
#
1515
#, fuzzy
1616
msgid ""
@@ -19,7 +19,7 @@ msgstr ""
1919
"Report-Msgid-Bugs-To: \n"
2020
"POT-Creation-Date: 2021-07-26 07:02+0000\n"
2121
"PO-Revision-Date: 2017-02-16 17:45+0000\n"
22-
"Last-Translator: Dai Xu <daixu61@hotmail.com>, 2021\n"
22+
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2021\n"
2323
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2424
"MIME-Version: 1.0\n"
2525
"Content-Type: text/plain; charset=UTF-8\n"
@@ -546,7 +546,7 @@ msgstr ""
546546

547547
#: ../../howto/logging-cookbook.rst:952
548548
msgid "Using concurrent.futures.ProcessPoolExecutor"
549-
msgstr ""
549+
msgstr "concurrent.futures.ProcessPoolExecutor 的用法"
550550

551551
#: ../../howto/logging-cookbook.rst:954
552552
msgid ""
@@ -559,15 +559,15 @@ msgstr ""
559559

560560
#: ../../howto/logging-cookbook.rst:962
561561
msgid "you should use"
562-
msgstr ""
562+
msgstr "而应是:"
563563

564564
#: ../../howto/logging-cookbook.rst:968
565565
msgid "and you can then replace the worker creation from this::"
566566
msgstr "然后就可以将以下工作进程的创建过程:"
567567

568568
#: ../../howto/logging-cookbook.rst:979
569569
msgid "to this (remembering to first import :mod:`concurrent.futures`)::"
570-
msgstr ""
570+
msgstr "改为 (记得要先导入 :mod:`concurrent.futures`)::"
571571

572572
#: ../../howto/logging-cookbook.rst:987
573573
msgid "Using file rotation"
@@ -736,7 +736,7 @@ msgstr "在用 Python 3.2 以上版本运行时,上述代码应该会把 ``Hel
736736

737737
#: ../../howto/logging-cookbook.rst:1216
738738
msgid "Customizing ``LogRecord``"
739-
msgstr ""
739+
msgstr "自定义 ``LogRecord``"
740740

741741
#: ../../howto/logging-cookbook.rst:1218
742742
msgid ""
@@ -1085,7 +1085,7 @@ msgstr ""
10851085

10861086
#: ../../howto/logging-cookbook.rst:1731
10871087
msgid "Implementing structured logging"
1088-
msgstr ""
1088+
msgstr "结构化日志的实现代码"
10891089

10901090
#: ../../howto/logging-cookbook.rst:1733
10911091
msgid ""
@@ -1155,7 +1155,7 @@ msgstr "出于演示目的,以下示例设置用户和用户组为 ``pulse``
11551155

11561156
#: ../../howto/logging-cookbook.rst:1917
11571157
msgid "To run this, you will probably need to run as ``root``:"
1158-
msgstr ""
1158+
msgstr "可能需要 ``root`` 权限才能运行:"
11591159

11601160
#: ../../howto/logging-cookbook.rst:1927
11611161
msgid ""
@@ -1177,7 +1177,7 @@ msgstr "实际应用中,handler 的创建函数可能位于项目的工具模
11771177

11781178
#: ../../howto/logging-cookbook.rst:1938
11791179
msgid "you could use e.g.::"
1180-
msgstr ""
1180+
msgstr "应使用:"
11811181

11821182
#: ../../howto/logging-cookbook.rst:1942
11831183
msgid ""
@@ -1265,7 +1265,7 @@ msgstr "为了让第三方库和自编代码都能够交互使用日志功能,
12651265

12661266
#: ../../howto/logging-cookbook.rst:1993
12671267
msgid "Using LogRecord factories"
1268-
msgstr ""
1268+
msgstr "LogRecord 工厂的用法"
12691269

12701270
#: ../../howto/logging-cookbook.rst:1995
12711271
msgid ""
@@ -1351,7 +1351,7 @@ msgstr ""
13511351

13521352
#: ../../howto/logging-cookbook.rst:2081
13531353
msgid "Configuring filters with :func:`dictConfig`"
1354-
msgstr ""
1354+
msgstr "用 :func:`dictConfig` 配置过滤器"
13551355

13561356
#: ../../howto/logging-cookbook.rst:2083
13571357
msgid ""
@@ -1387,7 +1387,7 @@ msgstr "这说明过滤器按照配置的参数生效了。"
13871387

13881388
#: ../../howto/logging-cookbook.rst:2146
13891389
msgid "A couple of extra points to note:"
1390-
msgstr ""
1390+
msgstr "需要额外注意的地方:"
13911391

13921392
#: ../../howto/logging-cookbook.rst:2148
13931393
msgid ""
@@ -1683,7 +1683,7 @@ msgstr "在单独的文件中分发多条子命令,同一级别的日志子命
16831683

16841684
#: ../../howto/logging-cookbook.rst:2598
16851685
msgid "Make use of simple, minimal configuration"
1686-
msgstr ""
1686+
msgstr "最简单的配置用法"
16871687

16881688
#: ../../howto/logging-cookbook.rst:2600
16891689
msgid ""
@@ -1811,31 +1811,34 @@ msgid ""
18111811
"However, on POSIX platforms you'll not get any errors if you open the same "
18121812
"file multiple times. This could be done accidentally, for example by:"
18131813
msgstr ""
1814+
"因会导致 \"文件被其他进程占用 \"错误,所以在 Windows 中一般无法多次打开同一个文件。但在 POSIX "
1815+
"平台中,多次打开同一个文件不会报任何错误。这种操作可能是意外发生的,比如:"
18141816

18151817
#: ../../howto/logging-cookbook.rst:3003
18161818
msgid ""
18171819
"Adding a file handler more than once which references the same file (e.g. by"
18181820
" a copy/paste/forget-to-change error)."
1819-
msgstr ""
1821+
msgstr "多次添加指向同一文件的 handler(比如通过复制/粘贴,或忘记修改)。"
18201822

18211823
#: ../../howto/logging-cookbook.rst:3006
18221824
msgid ""
18231825
"Opening two files that look different, as they have different names, but are"
18241826
" the same because one is a symbolic link to the other."
1825-
msgstr ""
1827+
msgstr "打开两个貌似不同(文件名不一样)的文件,但一个是另一个的符号链接,所以其实是同一个文件。"
18261828

18271829
#: ../../howto/logging-cookbook.rst:3009
18281830
msgid ""
18291831
"Forking a process, following which both parent and child have a reference to"
18301832
" the same file. This might be through use of the :mod:`multiprocessing` "
18311833
"module, for example."
18321834
msgstr ""
1835+
"进程 fork,然后父进程和子进程都有对同一文件的引用。 例如,这可能是通过使用 :mod:`multiprocessing` 模块实现的。"
18331836

18341837
#: ../../howto/logging-cookbook.rst:3013
18351838
msgid ""
18361839
"Opening a file multiple times might *appear* to work most of the time, but "
18371840
"can lead to a number of problems in practice:"
1838-
msgstr ""
1841+
msgstr "在大多数情况下,多次打开同一个文件 *貌似* 一切正常,但实际会导致很多问题。"
18391842

18401843
#: ../../howto/logging-cookbook.rst:3016
18411844
msgid ""
@@ -1845,6 +1848,8 @@ msgid ""
18451848
"if concurrent writes are attempted by two different threads using two "
18461849
"different handler instances which happen to point to the same file."
18471850
msgstr ""
1851+
"由于多个线程或进程会尝试写入同一个文件,日志输出可能会出现乱码。尽管日志对象可以防止多个线程同时使用同一个 handler "
1852+
"实例,但如果两个不同的线程使用不同的 handler 实例同时写入文件,而这两个 handler 又恰好指向同一个文件,那么就失去了这种防护。"
18481853

18491854
#: ../../howto/logging-cookbook.rst:3022
18501855
msgid ""
@@ -1853,16 +1858,17 @@ msgid ""
18531858
"confusion and wasted debugging time - log entries end up in unexpected "
18541859
"places, or are lost altogether."
18551860
msgstr ""
1861+
"删除文件(例如在轮换日志文件时)会静默失败,因为有另一个引用指向这个文件。这可能导致混乱并浪费调试时间——日志项最后会出现在意想不到的地方,或者干脆丢失。"
18561862

18571863
#: ../../howto/logging-cookbook.rst:3027
18581864
msgid ""
18591865
"Use the techniques outlined in :ref:`multiple-processes` to circumvent such "
18601866
"issues."
1861-
msgstr ""
1867+
msgstr "请用 :ref:`multiple-processes` 中介绍的技术来避免上述问题。"
18621868

18631869
#: ../../howto/logging-cookbook.rst:3031
18641870
msgid "Using loggers as attributes in a class or passing them as parameters"
1865-
msgstr ""
1871+
msgstr "将日志对象用作属性或传递参数"
18661872

18671873
#: ../../howto/logging-cookbook.rst:3033
18681874
msgid ""
@@ -1874,11 +1880,14 @@ msgid ""
18741880
"attributes. However, this pattern doesn't make sense in Python, where the "
18751881
"module (and not the class) is the unit of software decomposition."
18761882
msgstr ""
1883+
"虽然特殊情况下可能有必要如此,但一般来说没有意义,因为日志是单实例对象。代码总是可以通过 ``logging.getLogger(name)`` "
1884+
"用名称访问一个已有的日志对象实例,因此将实例作为参数来传递,或作为属性留存,都是毫无意义的。请注意,在其他语言中,如 Java 和 "
1885+
"C#,日志对象通常是静态类属性。但在 Python 中是没有意义的,因为软件拆分的单位是模块(而不是类)。"
18771886

18781887
#: ../../howto/logging-cookbook.rst:3043
18791888
msgid ""
18801889
"Adding handlers other than :class:`NullHandler` to a logger in a library"
1881-
msgstr ""
1890+
msgstr "给日志库代码添加 :class:`NullHandler` 之外的其他 handler"
18821891

18831892
#: ../../howto/logging-cookbook.rst:3045
18841893
msgid ""
@@ -1887,10 +1896,13 @@ msgid ""
18871896
"you are maintaining a library, ensure that you don't add handlers to any of "
18881897
"your loggers other than a :class:`~logging.NullHandler` instance."
18891898
msgstr ""
1899+
"通过添加 handler、formatter 和 filter "
1900+
"来配置日志,这是应用程序开发人员的责任,而不是库开发人员该做的。如果正在维护一个库,请确保不要向任何日志对象添加 "
1901+
":class:`~logging.NullHandler` 实例以外的 handler。"
18901902

18911903
#: ../../howto/logging-cookbook.rst:3052
18921904
msgid "Creating a lot of loggers"
1893-
msgstr ""
1905+
msgstr "创建大量的日志对象"
18941906

18951907
#: ../../howto/logging-cookbook.rst:3054
18961908
msgid ""
@@ -1902,3 +1914,6 @@ msgid ""
19021914
"those describing areas within your application (generally modules, but "
19031915
"occasionally slightly more fine-grained than that)."
19041916
msgstr ""
1917+
"日志是单实例对象,在代码执行过程中不会被释放,因此创建大量的日志对象会占用很多内存,而这些内存又不能被释放。与其为每个文件或网络连接创建一个日志,还不如利用"
1918+
" :ref:`已有机制 <context-info>` "
1919+
"将上下文信息传给自定义日志对象,并将创建的日志对象限制在应用程序内的指定区域(通常是模块,但偶尔会再精细些)使用。"

0 commit comments

Comments
 (0)