Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
84de34e3
Commit
84de34e3
authored
Jul 01, 2019
by
Vinay Sajip
Committed by
GitHub
Jul 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-32934: Clarified meaning of 'capacity' for BufferingHandler and MemoryHandler. (GH-14498)
parent
4a2edc34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
Doc/howto/logging-cookbook.rst
Doc/howto/logging-cookbook.rst
+3
-3
Doc/library/logging.handlers.rst
Doc/library/logging.handlers.rst
+9
-7
No files found.
Doc/howto/logging-cookbook.rst
View file @
84de34e3
...
...
@@ -2266,9 +2266,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::
...
...
Doc/library/logging.handlers.rst
View file @
84de34e3
...
...
@@ -861,7 +861,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)
...
...
@@ -885,12 +886,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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment