[Python-checkins] bpo-32934: Clarified meaning of 'capacity' for BufferingHandler and MemoryHandler. (GH-14498) (GH-14508)
Vinay Sajip
webhook-mailer at python.org
Mon Jul 1 08:12:03 EDT 2019
https://github.com/python/cpython/commit/471d785dc759eb2e9c06f077f323cf136d32506b
commit: 471d785dc759eb2e9c06f077f323cf136d32506b
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: 2019-07-01T13:11:37+01:00
summary:
bpo-32934: Clarified meaning of 'capacity' for BufferingHandler and MemoryHandler. (GH-14498) (GH-14508)
(cherry picked from commit 84de34e39eb9e49b2ae691c6f67df8d7da3561de)
files:
M Doc/howto/logging-cookbook.rst
M Doc/library/logging.handlers.rst
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index e391506ce2e4..105ae5ed25a0 100644
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -2267,9 +2267,9 @@ The script just arranges to decorate ``foo`` with a decorator which will do the
conditional logging that's required. The decorator takes a logger as a parameter
and attaches a memory handler for the duration of the call to the decorated
function. The decorator can be additionally parameterised using a target handler,
-a level at which flushing should occur, and a capacity for the buffer. These
-default to a :class:`~logging.StreamHandler` which writes to ``sys.stderr``,
-``logging.ERROR`` and ``100`` respectively.
+a level at which flushing should occur, and a capacity for the buffer (number of
+records buffered). These default to a :class:`~logging.StreamHandler` which
+writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` respectively.
Here's the script::
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst
index b48d50f9e9e5..b2ebafa83b2e 100644
--- a/Doc/library/logging.handlers.rst
+++ b/Doc/library/logging.handlers.rst
@@ -840,7 +840,8 @@ should, then :meth:`flush` is expected to do the flushing.
.. class:: BufferingHandler(capacity)
- Initializes the handler with a buffer of the specified capacity.
+ Initializes the handler with a buffer of the specified capacity. Here,
+ *capacity* means the number of logging records buffered.
.. method:: emit(record)
@@ -864,12 +865,13 @@ should, then :meth:`flush` is expected to do the flushing.
.. class:: MemoryHandler(capacity, flushLevel=ERROR, target=None, flushOnClose=True)
Returns a new instance of the :class:`MemoryHandler` class. The instance is
- initialized with a buffer size of *capacity*. If *flushLevel* is not specified,
- :const:`ERROR` is used. If no *target* is specified, the target will need to be
- set using :meth:`setTarget` before this handler does anything useful. If
- *flushOnClose* is specified as ``False``, then the buffer is *not* flushed when
- the handler is closed. If not specified or specified as ``True``, the previous
- behaviour of flushing the buffer will occur when the handler is closed.
+ initialized with a buffer size of *capacity* (number of records buffered).
+ If *flushLevel* is not specified, :const:`ERROR` is used. If no *target* is
+ specified, the target will need to be set using :meth:`setTarget` before this
+ handler does anything useful. If *flushOnClose* is specified as ``False``,
+ then the buffer is *not* flushed when the handler is closed. If not specified
+ or specified as ``True``, the previous behaviour of flushing the buffer will
+ occur when the handler is closed.
.. versionchanged:: 3.6
The *flushOnClose* parameter was added.
More information about the Python-checkins
mailing list