cpython: 0577c9a82c0a (original) (raw)
Mercurial > cpython
changeset 85567:0577c9a82c0a 3.3
Issue #18941: Respected delay when doing rollover. [#18941]
Vinay Sajip <vinay_sajip@yahoo.co.uk> | |
---|---|
date | Fri, 06 Sep 2013 10:25:31 +0100 |
parents | 324774a59256 |
children | 7627fea85a6d 7611e7244bdd |
files | Lib/logging/__init__.py Lib/logging/handlers.py |
diffstat | 2 files changed, 7 insertions(+), 4 deletions(-)[+] [-] Lib/logging/__init__.py 5 Lib/logging/handlers.py 6 |
line wrap: on
line diff
--- a/Lib/logging/init.py +++ b/Lib/logging/init.py @@ -1,4 +1,4 @@ -# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 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,
@@ -18,7 +18,7 @@
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
-Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away
"""
@@ -957,6 +957,7 @@ class FileHandler(StreamHandler):
self.baseFilename = os.path.abspath(filename)
self.mode = mode
self.encoding = encoding
self.delay = delay[](#l1.22) if delay:[](#l1.23) #We don't open the stream, but we still need to call the[](#l1.24) #Handler constructor to set level, formatter, lock etc.[](#l1.25)
--- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -174,7 +174,8 @@ class RotatingFileHandler(BaseRotatingHa if os.path.exists(dfn): os.remove(dfn) self.rotate(self.baseFilename, dfn)
self.stream = self._open()[](#l2.7)
if not self.delay:[](#l2.8)
self.stream = self._open()[](#l2.9)
def shouldRollover(self, record): """ @@ -382,7 +383,8 @@ class TimedRotatingFileHandler(BaseRotat if self.backupCount > 0: for s in self.getFilesToDelete(): os.remove(s)
self.stream = self._open()[](#l2.17)
if not self.delay:[](#l2.18)
self.stream = self._open()[](#l2.19) newRolloverAt = self.computeRollover(currentTime)[](#l2.20) while newRolloverAt <= currentTime:[](#l2.21) newRolloverAt = newRolloverAt + self.interval[](#l2.22)