Skip to content

Commit 3b8075f

Browse files
authored
bpo-44473: Update docstring and documentation for QueueHandler.prepar… (GH-27140)
…e().
1 parent d59d737 commit 3b8075f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Doc/library/logging.handlers.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,8 +1014,12 @@ possible, while any potentially slow operations (such as sending an email via
10141014
method is enqueued.
10151015

10161016
The base implementation formats the record to merge the message,
1017-
arguments, and exception information, if present. It also
1018-
removes unpickleable items from the record in-place.
1017+
arguments, and exception information, if present. It also removes
1018+
unpickleable items from the record in-place. Specifically, it overwrites
1019+
the record's :attr:`msg` and :attr:`message` attributes with the merged
1020+
message (obtained by calling the handler's :meth:`format` method), and
1021+
sets the :attr:`args`, :attr:`exc_info` and :attr:`exc_text` attributes
1022+
to ``None``.
10191023

10201024
You might want to override this method if you want to convert
10211025
the record to a dict or JSON string, or send a modified copy

Lib/logging/handlers.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,15 @@ def enqueue(self, record):
13991399

14001400
def prepare(self, record):
14011401
"""
1402-
Prepares a record for queuing. The object returned by this method is
1402+
Prepare a record for queuing. The object returned by this method is
14031403
enqueued.
14041404
1405-
The base implementation formats the record to merge the message
1406-
and arguments, and removes unpickleable items from the record
1407-
in-place.
1405+
The base implementation formats the record to merge the message and
1406+
arguments, and removes unpickleable items from the record in-place.
1407+
Specifically, it overwrites the record's `msg` and
1408+
`message` attributes with the merged message (obtained by
1409+
calling the handler's `format` method), and sets the `args`,
1410+
`exc_info` and `exc_text` attributes to None.
14081411
14091412
You might want to override this method if you want to convert
14101413
the record to a dict or JSON string, or send a modified copy

0 commit comments

Comments
 (0)