@@ -12,7 +12,7 @@ msgid ""
12
12
msgstr ""
13
13
"Project-Id-Version : Python 3.13\n "
14
14
"Report-Msgid-Bugs-To : \n "
15
- "POT-Creation-Date : 2025-05-30 14:58 +0000\n "
15
+ "POT-Creation-Date : 2025-06-27 14:55 +0000\n "
16
16
"PO-Revision-Date : 2025-05-08 05:09+0000\n "
17
17
"
Last-Translator :
Freesand Leo <[email protected] >, 2025\n "
18
18
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -1678,7 +1678,7 @@ msgstr ""
1678
1678
"使用 :class:`~queue.SimpleQueue` 实例。"
1679
1679
1680
1680
#: ../../library/logging.handlers.rst:1052
1681
- #: ../../library/logging.handlers.rst:1141
1681
+ #: ../../library/logging.handlers.rst:1150
1682
1682
msgid ""
1683
1683
"If you are using :mod:`multiprocessing`, you should avoid using "
1684
1684
":class:`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`."
@@ -1688,6 +1688,20 @@ msgstr ""
1688
1688
1689
1689
#: ../../library/logging.handlers.rst:1057
1690
1690
msgid ""
1691
+ "The :mod:`multiprocessing` module uses an internal logger created and "
1692
+ "accessed via :meth:`~multiprocessing.get_logger`. "
1693
+ ":class:`multiprocessing.Queue` will log ``DEBUG`` level messages upon items "
1694
+ "being queued. If those log messages are processed by a :class:`QueueHandler`"
1695
+ " using the same :class:`multiprocessing.Queue` instance, it will cause a "
1696
+ "deadlock or infinite recursion."
1697
+ msgstr ""
1698
+ ":mod:`multiprocessing` 模块使用一个通过 :meth:`~multiprocessing.get_logger` "
1699
+ "创建和访问的内部记录器。 :class:`multiprocessing.Queue` 将记录正在排队的项目的 ``DEBUG`` 级消息。 "
1700
+ "如果这些日志消息由 :class:`QueueHandler` 使用相同的 :class:`multiprocessing.Queue` "
1701
+ "实例进行处理,则会导致死锁或无限递归。"
1702
+
1703
+ #: ../../library/logging.handlers.rst:1066
1704
+ msgid ""
1691
1705
"Enqueues the result of preparing the LogRecord. Should an exception occur "
1692
1706
"(e.g. because a bounded queue has filled up), the "
1693
1707
":meth:`~logging.Handler.handleError` method is called to handle the error. "
@@ -1700,13 +1714,13 @@ msgstr ""
1700
1714
":data:`logging.raiseExceptions` 为 ``False`` 时) 或者消息被打印到 ``sys.stderr`` (当 "
1701
1715
":data:`logging.raiseExceptions` 为 ``True`` 时)。"
1702
1716
1703
- #: ../../library/logging.handlers.rst:1066
1717
+ #: ../../library/logging.handlers.rst:1075
1704
1718
msgid ""
1705
1719
"Prepares a record for queuing. The object returned by this method is "
1706
1720
"enqueued."
1707
1721
msgstr "准备用于队列的记录。 此方法返回的对象会被排入队列。"
1708
1722
1709
- #: ../../library/logging.handlers.rst:1069
1723
+ #: ../../library/logging.handlers.rst:1078
1710
1724
msgid ""
1711
1725
"The base implementation formats the record to merge the message, arguments, "
1712
1726
"exception and stack information, if present. It also removes unpickleable "
@@ -1720,14 +1734,14 @@ msgstr ""
1720
1734
":attr:`message` 属性,并将 :attr:`args`, :attr:`exc_info` 和 :attr:`exc_text` "
1721
1735
"属性设置为 ``None``。"
1722
1736
1723
- #: ../../library/logging.handlers.rst:1077
1737
+ #: ../../library/logging.handlers.rst:1086
1724
1738
msgid ""
1725
1739
"You might want to override this method if you want to convert the record to "
1726
1740
"a dict or JSON string, or send a modified copy of the record while leaving "
1727
1741
"the original intact."
1728
1742
msgstr "如果你想要将记录转换为 dict 或 JSON 字符串,或者发送记录被修改后的副本而让初始记录保持原样,则你可能会想要重写此方法。"
1729
1743
1730
- #: ../../library/logging.handlers.rst:1081
1744
+ #: ../../library/logging.handlers.rst:1090
1731
1745
msgid ""
1732
1746
"The base implementation formats the message with arguments, sets the "
1733
1747
"``message`` and ``msg`` attributes to the formatted message and sets the "
@@ -1749,14 +1763,14 @@ msgstr ""
1749
1763
"``msg`` / ``args`` 的改变与确保记录可以 pickle 是相关联的,根据你的 ``args`` 是否可以 pickle "
1750
1764
"你将可能或不可能避免这样做。 (请注意你可能必须不仅要考虑你自己的代码还要考虑你所使用的任何库中的代码。)"
1751
1765
1752
- #: ../../library/logging.handlers.rst:1097
1766
+ #: ../../library/logging.handlers.rst:1106
1753
1767
msgid ""
1754
1768
"Enqueues the record on the queue using ``put_nowait()``; you may want to "
1755
1769
"override this if you want to use blocking behaviour, or a timeout, or a "
1756
1770
"customized queue implementation."
1757
1771
msgstr "使用 ``put_nowait()`` 将记录排入队列;如果你想要使用阻塞行为,或超时设置,或自定义的队列实现,则你可能会想要重写此方法。"
1758
1772
1759
- #: ../../library/logging.handlers.rst:1103
1773
+ #: ../../library/logging.handlers.rst:1112
1760
1774
msgid ""
1761
1775
"When created via configuration using :func:`~logging.config.dictConfig`, "
1762
1776
"this attribute will contain a :class:`QueueListener` instance for use with "
@@ -1765,11 +1779,11 @@ msgstr ""
1765
1779
"当通过使用 :func:`~logging.config.dictConfig` 的配置创建时,该属性将包含一个 "
1766
1780
":class:`QueueListener` 实例供此处理器使用。 在其他情况下,它将为 ``None``。"
1767
1781
1768
- #: ../../library/logging.handlers.rst:1112
1782
+ #: ../../library/logging.handlers.rst:1121
1769
1783
msgid "QueueListener"
1770
1784
msgstr "QueueListener"
1771
1785
1772
- #: ../../library/logging.handlers.rst:1116
1786
+ #: ../../library/logging.handlers.rst:1125
1773
1787
msgid ""
1774
1788
"The :class:`QueueListener` class, located in the :mod:`logging.handlers` "
1775
1789
"module, supports receiving logging messages from a queue, such as those "
@@ -1784,7 +1798,7 @@ msgstr ""
1784
1798
"消息是在内部线程中从队列接收并在同一线程上传递到一个或多个处理程序进行处理的。 尽管 :class:`QueueListener` "
1785
1799
"本身并不是一个处理程序,但由于它要与 :class:`QueueHandler` 配合工作,因此也在此处介绍。"
1786
1800
1787
- #: ../../library/logging.handlers.rst:1124
1801
+ #: ../../library/logging.handlers.rst:1133
1788
1802
msgid ""
1789
1803
"Along with the :class:`QueueHandler` class, :class:`QueueListener` can be "
1790
1804
"used to let handlers do their work on a separate thread from the one which "
@@ -1798,7 +1812,7 @@ msgstr ""
1798
1812
"应用程序以及其他服务于客户端的线程需要尽可能快地响应的服务应用程序来说很重要,任何潜在的慢速动作(例如通过 :class:`SMTPHandler` "
1799
1813
"发送邮件)都要在单独的线程上完成。"
1800
1814
1801
- #: ../../library/logging.handlers.rst:1133
1815
+ #: ../../library/logging.handlers.rst:1142
1802
1816
msgid ""
1803
1817
"Returns a new instance of the :class:`QueueListener` class. The instance is "
1804
1818
"initialized with the queue to send messages to and a list of handlers which "
@@ -1813,7 +1827,7 @@ msgstr ""
1813
1827
":meth:`dequeue` 方法,该方法需要知道如何从其获取消息。 队列 *不要求* 具有任务跟踪 API(但如提供则会使用它),这意味着你可以为 "
1814
1828
"*queue* 使用 :class:`~queue.SimpleQueue` 实例。"
1815
1829
1816
- #: ../../library/logging.handlers.rst:1144
1830
+ #: ../../library/logging.handlers.rst:1153
1817
1831
msgid ""
1818
1832
"If ``respect_handler_level`` is ``True``, a handler's level is respected "
1819
1833
"(compared with the level for the message) when deciding whether to pass "
@@ -1824,71 +1838,71 @@ msgstr ""
1824
1838
"``True``,则在决定是否将消息传递给处理程序之前会遵循处理程序的级别(与消息的级别进行比较);在其他情况下,其行为与之前的 Python 版本一致"
1825
1839
" —— 总是将每条消息传递给每个处理程序。"
1826
1840
1827
- #: ../../library/logging.handlers.rst:1149
1841
+ #: ../../library/logging.handlers.rst:1158
1828
1842
msgid "The ``respect_handler_level`` argument was added."
1829
1843
msgstr "增加了 ``respect_handler_level`` 参数。"
1830
1844
1831
- #: ../../library/logging.handlers.rst:1154
1845
+ #: ../../library/logging.handlers.rst:1163
1832
1846
msgid "Dequeues a record and return it, optionally blocking."
1833
1847
msgstr "从队列移出一条记录并将其返回,可以选择阻塞。"
1834
1848
1835
- #: ../../library/logging.handlers.rst:1156
1849
+ #: ../../library/logging.handlers.rst:1165
1836
1850
msgid ""
1837
1851
"The base implementation uses ``get()``. You may want to override this method"
1838
1852
" if you want to use timeouts or work with custom queue implementations."
1839
1853
msgstr "基本实现使用 ``get()``。 如果你想要使用超时设置或自定义的队列实现,则你可能会想要重写此方法。"
1840
1854
1841
- #: ../../library/logging.handlers.rst:1162
1855
+ #: ../../library/logging.handlers.rst:1171
1842
1856
msgid "Prepare a record for handling."
1843
1857
msgstr "准备一条要处理的记录。"
1844
1858
1845
- #: ../../library/logging.handlers.rst:1164
1859
+ #: ../../library/logging.handlers.rst:1173
1846
1860
msgid ""
1847
1861
"This implementation just returns the passed-in record. You may want to "
1848
1862
"override this method if you need to do any custom marshalling or "
1849
1863
"manipulation of the record before passing it to the handlers."
1850
1864
msgstr ""
1851
1865
"该实现只是返回传入的记录。 如果你想要对记录执行任何自定义的 marshal 操作或在将其传给处理程序之前进行调整,则你可能会想要重写此方法。"
1852
1866
1853
- #: ../../library/logging.handlers.rst:1170
1867
+ #: ../../library/logging.handlers.rst:1179
1854
1868
msgid "Handle a record."
1855
1869
msgstr "处理一条记录。"
1856
1870
1857
- #: ../../library/logging.handlers.rst:1172
1871
+ #: ../../library/logging.handlers.rst:1181
1858
1872
msgid ""
1859
1873
"This just loops through the handlers offering them the record to handle. The"
1860
1874
" actual object passed to the handlers is that which is returned from "
1861
1875
":meth:`prepare`."
1862
1876
msgstr "此方法简单地循环遍历处理程序,向它们提供要处理的记录。 实际传给处理程序的对象就是从 :meth:`prepare` 返回的对象。"
1863
1877
1864
- #: ../../library/logging.handlers.rst:1178
1878
+ #: ../../library/logging.handlers.rst:1187
1865
1879
msgid "Starts the listener."
1866
1880
msgstr "启动监听器。"
1867
1881
1868
- #: ../../library/logging.handlers.rst:1180
1882
+ #: ../../library/logging.handlers.rst:1189
1869
1883
msgid ""
1870
1884
"This starts up a background thread to monitor the queue for LogRecords to "
1871
1885
"process."
1872
1886
msgstr "此方法启动一个后台线程来监视 LogRecords 队列以进行处理。"
1873
1887
1874
- #: ../../library/logging.handlers.rst:1183
1888
+ #: ../../library/logging.handlers.rst:1192
1875
1889
msgid ""
1876
1890
"Raises :exc:`RuntimeError` if called and the listener is already running."
1877
1891
msgstr "如果被调用时监听器已在运行则会引发 :exc:`RuntimeError`。"
1878
1892
1879
- #: ../../library/logging.handlers.rst:1189
1893
+ #: ../../library/logging.handlers.rst:1198
1880
1894
msgid "Stops the listener."
1881
1895
msgstr "停止监听器。"
1882
1896
1883
- #: ../../library/logging.handlers.rst:1191
1897
+ #: ../../library/logging.handlers.rst:1200
1884
1898
msgid ""
1885
1899
"This asks the thread to terminate, and then waits for it to do so. Note that"
1886
1900
" if you don't call this before your application exits, there may be some "
1887
1901
"records still left on the queue, which won't be processed."
1888
1902
msgstr ""
1889
1903
"此方法要求线程终止,然后等待它完成终止操作。 请注意在你的应用程序退出之前如果你没有调用此方法,则可能会有一些记录在留在队列中,它们将不会被处理。"
1890
1904
1891
- #: ../../library/logging.handlers.rst:1197
1905
+ #: ../../library/logging.handlers.rst:1206
1892
1906
msgid ""
1893
1907
"Writes a sentinel to the queue to tell the listener to quit. This "
1894
1908
"implementation uses ``put_nowait()``. You may want to override this method "
@@ -1897,18 +1911,18 @@ msgstr ""
1897
1911
"将一个标记写入队列以通知监听器退出。 此实现会使用 ``put_nowait()``。 "
1898
1912
"如果你想要使得超时设置或自定义的队列实现,则你可能会想要重写此方法。"
1899
1913
1900
- #: ../../library/logging.handlers.rst:1207
1914
+ #: ../../library/logging.handlers.rst:1216
1901
1915
msgid "Module :mod:`logging`"
1902
1916
msgstr "模块 :mod:`logging`"
1903
1917
1904
- #: ../../library/logging.handlers.rst:1208
1918
+ #: ../../library/logging.handlers.rst:1217
1905
1919
msgid "API reference for the logging module."
1906
1920
msgstr "日志记录模块的 API 参考。"
1907
1921
1908
- #: ../../library/logging.handlers.rst:1210
1922
+ #: ../../library/logging.handlers.rst:1219
1909
1923
msgid "Module :mod:`logging.config`"
1910
1924
msgstr ":mod:`logging.config` 模块"
1911
1925
1912
- #: ../../library/logging.handlers.rst:1211
1926
+ #: ../../library/logging.handlers.rst:1220
1913
1927
msgid "Configuration API for the logging module."
1914
1928
msgstr "日志记录模块的配置 API 。"
0 commit comments