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

Skip to content

Commit 84de34e

Browse files
authored
bpo-32934: Clarified meaning of 'capacity' for BufferingHandler and MemoryHandler. (GH-14498)
1 parent 4a2edc3 commit 84de34e

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

Doc/howto/logging-cookbook.rst

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

22732273
Here's the script::
22742274

Doc/library/logging.handlers.rst

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

862862
.. class:: BufferingHandler(capacity)
863863

864-
Initializes the handler with a buffer of the specified capacity.
864+
Initializes the handler with a buffer of the specified capacity. Here,
865+
*capacity* means the number of logging records buffered.
865866

866867

867868
.. method:: emit(record)
@@ -885,12 +886,13 @@ should, then :meth:`flush` is expected to do the flushing.
885886
.. class:: MemoryHandler(capacity, flushLevel=ERROR, target=None, flushOnClose=True)
886887

887888
Returns a new instance of the :class:`MemoryHandler` class. The instance is
888-
initialized with a buffer size of *capacity*. If *flushLevel* is not specified,
889-
:const:`ERROR` is used. If no *target* is specified, the target will need to be
890-
set using :meth:`setTarget` before this handler does anything useful. If
891-
*flushOnClose* is specified as ``False``, then the buffer is *not* flushed when
892-
the handler is closed. If not specified or specified as ``True``, the previous
893-
behaviour of flushing the buffer will occur when the handler is closed.
889+
initialized with a buffer size of *capacity* (number of records buffered).
890+
If *flushLevel* is not specified, :const:`ERROR` is used. If no *target* is
891+
specified, the target will need to be set using :meth:`setTarget` before this
892+
handler does anything useful. If *flushOnClose* is specified as ``False``,
893+
then the buffer is *not* flushed when the handler is closed. If not specified
894+
or specified as ``True``, the previous behaviour of flushing the buffer will
895+
occur when the handler is closed.
894896

895897
.. versionchanged:: 3.6
896898
The *flushOnClose* parameter was added.

0 commit comments

Comments
 (0)