From 79fe67fa04b56be7ba3a7dce645b2f41f1715747 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 3 Sep 2022 05:16:40 -0700 Subject: [PATCH] =?UTF-8?q?[3.11]=20gh-89087:=20Update=20logging.QueueHand?= =?UTF-8?q?ler=20documentation=20to=20clarify=20record=E2=80=A6=20(GH-9652?= =?UTF-8?q?7)=20(GH-96528)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Doc/library/logging.handlers.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index c4f501faca6..8ab76ab93b6 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -1060,6 +1060,20 @@ possible, while any potentially slow operations (such as sending an email via the record to a dict or JSON string, or send a modified copy of the record while leaving the original intact. + .. note:: The base implementation formats the message with arguments, sets + the ``message`` and ``msg`` attributes to the formatted message and + sets the ``args`` and ``exc_text`` attributes to ``None`` to allow + pickling and to prevent further attempts at formatting. This means + that a handler on the :class:`QueueListener` side won't have the + information to do custom formatting, e.g. of exceptions. You may wish + to subclass ``QueueHandler`` and override this method to e.g. avoid + setting ``exc_text`` to ``None``. Note that the ``message`` / ``msg`` + / ``args`` changes are related to ensuring the record is pickleable, + and you might or might not be able to avoid doing that depending on + whether your ``args`` are pickleable. (Note that you may have to + consider not only your own code but also code in any libraries that + you use.) + .. method:: enqueue(record) Enqueues the record on the queue using ``put_nowait()``; you may -- GitLab