summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2004-02-21 22:14:34 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2004-02-21 22:14:34 (GMT)
commitf42d95ebd167b4a0b0edfdfc6f15bd8c5cec799b (patch)
treec63c8549a670801575458c91604067096c45a735
parent3f9f84def4c359204768f3934ec73f6c44434f9d (diff)
downloadcpython-f42d95ebd167b4a0b0edfdfc6f15bd8c5cec799b.zip
cpython-f42d95ebd167b4a0b0edfdfc6f15bd8c5cec799b.tar.gz
cpython-f42d95ebd167b4a0b0edfdfc6f15bd8c5cec799b.tar.bz2
Added close() (which flushes) to BufferingHandler and tidied MemoryHandler.close() [SF #901330]
-rw-r--r--Lib/logging/handlers.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index c556f1a..778c507 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2004 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
@@ -726,6 +726,15 @@ class BufferingHandler(logging.Handler):
"""
self.buffer = []
+ def close(self):
+ """
+ Close the handler.
+
+ This version just flushes and chains to the parent class' close().
+ """
+ self.flush()
+ logging.Handler.close(self)
+
class MemoryHandler(BufferingHandler):
"""
A handler class which buffers logging records in memory, periodically
@@ -774,5 +783,4 @@ class MemoryHandler(BufferingHandler):
"""
self.flush()
self.target = None
- self.buffer = []
BufferingHandler.close(self)