diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-07-30 09:41:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-30 09:41:45 (GMT) |
commit | 2543f50033208c1a8df04999082b11aa09e82a04 (patch) | |
tree | b74c99e4821404d6dfdc4d0076e0810690bcff73 /Doc | |
parent | 78c18a9b9a1445f7c755929917a790ba02b4a5e0 (diff) | |
download | cpython-2543f50033208c1a8df04999082b11aa09e82a04.zip cpython-2543f50033208c1a8df04999082b11aa09e82a04.tar.gz cpython-2543f50033208c1a8df04999082b11aa09e82a04.tar.bz2 |
bpo-30522: Implemented a method to allow setting a logging.StreamHander's stream. (GH-2921)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/logging.handlers.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index f13f765..0974286 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -59,6 +59,18 @@ and :meth:`flush` methods). :meth:`close` method is inherited from :class:`~logging.Handler` and so does no output, so an explicit :meth:`flush` call may be needed at times. + .. method:: setStream(stream) + + Sets the instance's stream to the specified value, if it is different. + The old stream is flushed before the new stream is set. + + :param stream: The stream that the handler should use. + + :return: the old stream, if the stream was changed, or *None* if it wasn't. + + .. versionadded:: 3.7 + + .. versionchanged:: 3.2 The ``StreamHandler`` class now has a ``terminator`` attribute, default value ``'\n'``, which is used as the terminator when writing a formatted @@ -66,6 +78,7 @@ and :meth:`flush` methods). set the handler instance's ``terminator`` attribute to the empty string. In earlier versions, the terminator was hardcoded as ``'\n'``. + .. _file-handler: FileHandler |