Skip to content

Commit 471d785

Browse files
miss-islingtonvsajip
authored andcommitted
bpo-32934: Clarified meaning of 'capacity' for BufferingHandler and MemoryHandler. (GH-14498) (GH-14508)
(cherry picked from commit 84de34e)
1 parent 6be9110 commit 471d785

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Doc/howto/logging-cookbook.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,9 +2267,9 @@ The script just arranges to decorate ``foo`` with a decorator which will do the
22672267
conditional logging that's required. The decorator takes a logger as a parameter
22682268
and attaches a memory handler for the duration of the call to the decorated
22692269
function. The decorator can be additionally parameterised using a target handler,
2270-
a level at which flushing should occur, and a capacity for the buffer. These
2271-
default to a :class:`~logging.StreamHandler` which writes to ``sys.stderr``,
2272-
``logging.ERROR`` and ``100`` respectively.
2270+
a level at which flushing should occur, and a capacity for the buffer (number of
2271+
records buffered). These default to a :class:`~logging.StreamHandler` which
2272+
writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` respectively.
22732273

22742274
Here's the script::
22752275

Doc/library/logging.handlers.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,8 @@ should, then :meth:`flush` is expected to do the flushing.
840840

841841
.. class:: BufferingHandler(capacity)
842842

843-
Initializes the handler with a buffer of the specified capacity.
843+
Initializes the handler with a buffer of the specified capacity. Here,
844+
*capacity* means the number of logging records buffered.
844845

845846

846847
.. method:: emit(record)
@@ -864,12 +865,13 @@ should, then :meth:`flush` is expected to do the flushing.
864865
.. class:: MemoryHandler(capacity, flushLevel=ERROR, target=None, flushOnClose=True)
865866

866867
Returns a new instance of the :class:`MemoryHandler` class. The instance is
867-
initialized with a buffer size of *capacity*. If *flushLevel* is not specified,
868-
:const:`ERROR` is used. If no *target* is specified, the target will need to be
869-
set using :meth:`setTarget` before this handler does anything useful. If
870-
*flushOnClose* is specified as ``False``, then the buffer is *not* flushed when
871-
the handler is closed. If not specified or specified as ``True``, the previous
872-
behaviour of flushing the buffer will occur when the handler is closed.
868+
initialized with a buffer size of *capacity* (number of records buffered).
869+
If *flushLevel* is not specified, :const:`ERROR` is used. If no *target* is
870+
specified, the target will need to be set using :meth:`setTarget` before this
871+
handler does anything useful. If *flushOnClose* is specified as ``False``,
872+
then the buffer is *not* flushed when the handler is closed. If not specified
873+
or specified as ``True``, the previous behaviour of flushing the buffer will
874+
occur when the handler is closed.
873875

874876
.. versionchanged:: 3.6
875877
The *flushOnClose* parameter was added.

0 commit comments

Comments
 (0)