From 5ccf2d6c219eb56fb47959012ef98ad8863cad1e Mon Sep 17 00:00:00 2001 From: Jochem Boersma Date: Sat, 22 Jul 2023 15:21:26 +0200 Subject: [PATCH 1/6] some textual changes in logging docs and docstrings for unambiguity --- Doc/library/logging.handlers.rst | 5 ++--- Lib/logging/handlers.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index 47bfe4ff7f90ed..cb8990ab8fd7ab 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -917,8 +917,7 @@ should, then :meth:`flush` is expected to do the flushing. .. method:: flush() - You can override this to implement custom flushing behavior. This version - just zaps the buffer to empty. + For a :class:`BufferHandler`, flushing means that it zaps the buffer to empty. This method can be overwritten to implement more useful flushing behavior. .. method:: shouldFlush(record) @@ -952,7 +951,7 @@ should, then :meth:`flush` is expected to do the flushing. For a :class:`MemoryHandler`, flushing means just sending the buffered records to the target, if there is one. The buffer is also cleared when - this happens. Override if you want different behavior. + buffered records are send. Override if you want different behavior. .. method:: setTarget(target) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 9847104446eaf6..38a9737b9e4b1a 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -1399,7 +1399,7 @@ def flush(self): records to the target, if there is one. Override if you want different behaviour. - The record buffer is also cleared by this operation. + The record buffer is only cleared afterwards, when target was set. """ self.acquire() try: From 84da016b1d2d707946def599051a98e49c5490d3 Mon Sep 17 00:00:00 2001 From: Jochem Boersma Date: Sat, 22 Jul 2023 16:07:39 +0200 Subject: [PATCH 2/6] Corrected class names in Co-authored-by: Vinay Sajip --- Doc/library/logging.handlers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index cb8990ab8fd7ab..4e82c5b9dc7527 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -917,7 +917,7 @@ should, then :meth:`flush` is expected to do the flushing. .. method:: flush() - For a :class:`BufferHandler`, flushing means that it zaps the buffer to empty. This method can be overwritten to implement more useful flushing behavior. + For a :class:`BufferingHandler` instance, flushing means that it sets the buffer to an empty list. This method can be overwritten to implement more useful flushing behavior. .. method:: shouldFlush(record) From 247aa11a1f141196c44fe2c263424bdf6cf0eb38 Mon Sep 17 00:00:00 2001 From: Jochem Boersma Date: Sat, 22 Jul 2023 16:08:16 +0200 Subject: [PATCH 3/6] Update Doc/library/logging.handlers.rst Co-authored-by: Vinay Sajip --- Doc/library/logging.handlers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index 4e82c5b9dc7527..17ed4a139b1fc4 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -951,7 +951,7 @@ should, then :meth:`flush` is expected to do the flushing. For a :class:`MemoryHandler`, flushing means just sending the buffered records to the target, if there is one. The buffer is also cleared when - buffered records are send. Override if you want different behavior. + buffered records are sent to the target. Override if you want different behavior. .. method:: setTarget(target) From 69f9f970db09b352a8adecea44a0382c763052db Mon Sep 17 00:00:00 2001 From: Jochem Boersma Date: Sat, 22 Jul 2023 16:23:06 +0200 Subject: [PATCH 4/6] made instance explicitly Co-authored-by: Vinay Sajip --- Doc/library/logging.handlers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index 17ed4a139b1fc4..0dcf92511d60da 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -949,7 +949,7 @@ should, then :meth:`flush` is expected to do the flushing. .. method:: flush() - For a :class:`MemoryHandler`, flushing means just sending the buffered + For a :class:`MemoryHandler` instance, flushing means just sending the buffered records to the target, if there is one. The buffer is also cleared when buffered records are sent to the target. Override if you want different behavior. From 1c5aa41fc3c87b774e1b2cc2f92ed01db40212a4 Mon Sep 17 00:00:00 2001 From: Jochem Boersma Date: Sat, 22 Jul 2023 16:30:14 +0200 Subject: [PATCH 5/6] proper line-lengths --- Doc/library/logging.handlers.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index 0dcf92511d60da..72e5ffb3a1218e 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -917,7 +917,9 @@ should, then :meth:`flush` is expected to do the flushing. .. method:: flush() - For a :class:`BufferingHandler` instance, flushing means that it sets the buffer to an empty list. This method can be overwritten to implement more useful flushing behavior. + For a :class:`BufferingHandler` instance, flushing means that it sets the + buffer to an empty list. This method can be overwritten to implement more useful + flushing behavior. .. method:: shouldFlush(record) From 5f6556f73878391039fa1f58131292a06624b9e0 Mon Sep 17 00:00:00 2001 From: Jochem Boersma Date: Sat, 22 Jul 2023 16:34:47 +0200 Subject: [PATCH 6/6] improved English sentence --- Lib/logging/handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 38a9737b9e4b1a..671cc9596b02dd 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -1399,7 +1399,7 @@ def flush(self): records to the target, if there is one. Override if you want different behaviour. - The record buffer is only cleared afterwards, when target was set. + The record buffer is only cleared if a target has been set. """ self.acquire() try: