]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added close() (which flushes) to BufferingHandler and tidied MemoryHandler.close...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 21 Feb 2004 22:14:34 +0000 (22:14 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 21 Feb 2004 22:14:34 +0000 (22:14 +0000)
Lib/logging/handlers.py

index c556f1a0ffe270d0bdb1d8757b99a3ed111572c3..778c5074b035ca095b4ee6f8e8ccc547e4336ada 100644 (file)
@@ -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)