diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2007-01-16 09:50:07 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2007-01-16 09:50:07 (GMT) |
commit | b3d8a06a462ed573e1d32991d6cefb74ef358fd4 (patch) | |
tree | edf9216449b997ee9e7d6c8b531a396250b5e30d /Lib/logging | |
parent | f5c034af10d98d58207eb063450a36c3c5fd10b2 (diff) | |
download | cpython-b3d8a06a462ed573e1d32991d6cefb74ef358fd4.zip cpython-b3d8a06a462ed573e1d32991d6cefb74ef358fd4.tar.gz cpython-b3d8a06a462ed573e1d32991d6cefb74ef358fd4.tar.bz2 |
Updated rotating file handlers to use _open().
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/handlers.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 1a82d9e..ed0b1e8 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -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 @@ Apache's log4j system. 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 @@ class RotatingFileHandler(BaseRotatingHandler): 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 @@ class TimedRotatingFileHandler(BaseRotatingHandler): 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): |