mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Updated rotating file handlers to use _open().
This commit is contained in:
parent
f5c034af10
commit
b3d8a06a46
1 changed files with 6 additions and 10 deletions
|
@ -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
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
# documentation for any purpose and without fee is hereby granted,
|
# 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
|
Should work under Python versions >= 1.5.2, except that source line
|
||||||
information is not available unless 'sys._getframe()' is.
|
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!
|
To use, simply 'import logging' and log away!
|
||||||
"""
|
"""
|
||||||
|
@ -131,10 +131,8 @@ class RotatingFileHandler(BaseRotatingHandler):
|
||||||
os.remove(dfn)
|
os.remove(dfn)
|
||||||
os.rename(self.baseFilename, dfn)
|
os.rename(self.baseFilename, dfn)
|
||||||
#print "%s -> %s" % (self.baseFilename, dfn)
|
#print "%s -> %s" % (self.baseFilename, dfn)
|
||||||
if self.encoding:
|
self.mode = 'w'
|
||||||
self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
|
self.stream = self._open()
|
||||||
else:
|
|
||||||
self.stream = open(self.baseFilename, 'w')
|
|
||||||
|
|
||||||
def shouldRollover(self, record):
|
def shouldRollover(self, record):
|
||||||
"""
|
"""
|
||||||
|
@ -277,10 +275,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||||
s.sort()
|
s.sort()
|
||||||
os.remove(s[0])
|
os.remove(s[0])
|
||||||
#print "%s -> %s" % (self.baseFilename, dfn)
|
#print "%s -> %s" % (self.baseFilename, dfn)
|
||||||
if self.encoding:
|
self.mode = 'w'
|
||||||
self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
|
self.stream = self._open()
|
||||||
else:
|
|
||||||
self.stream = open(self.baseFilename, 'w')
|
|
||||||
self.rolloverAt = self.rolloverAt + self.interval
|
self.rolloverAt = self.rolloverAt + self.interval
|
||||||
|
|
||||||
class WatchedFileHandler(logging.FileHandler):
|
class WatchedFileHandler(logging.FileHandler):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue