[Python-checkins] r53458 - python/trunk/Lib/logging/handlers.py
vinay.sajip
python-checkins at python.org
Tue Jan 16 10:50:07 CET 2007
Author: vinay.sajip
Date: Tue Jan 16 10:50:07 2007
New Revision: 53458
Modified:
python/trunk/Lib/logging/handlers.py
Log:
Updated rotating file handlers to use _open().
Modified: python/trunk/Lib/logging/handlers.py
==============================================================================
--- python/trunk/Lib/logging/handlers.py (original)
+++ python/trunk/Lib/logging/handlers.py Tue Jan 16 10:50:07 2007
@@ -1,4 +1,4 @@
-# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2007 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,
@@ -22,7 +22,7 @@
Should work under Python versions >= 1.5.2, except that source line
information is not available unless 'sys._getframe()' is.
-Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
@@ -131,10 +131,8 @@
os.remove(dfn)
os.rename(self.baseFilename, dfn)
#print "%s -> %s" % (self.baseFilename, dfn)
- if self.encoding:
- self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
- else:
- self.stream = open(self.baseFilename, 'w')
+ self.mode = 'w'
+ self.stream = self._open()
def shouldRollover(self, record):
"""
@@ -277,10 +275,8 @@
s.sort()
os.remove(s[0])
#print "%s -> %s" % (self.baseFilename, dfn)
- if self.encoding:
- self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
- else:
- self.stream = open(self.baseFilename, 'w')
+ self.mode = 'w'
+ self.stream = self._open()
self.rolloverAt = self.rolloverAt + self.interval
class WatchedFileHandler(logging.FileHandler):
More information about the Python-checkins
mailing list