MCPcopy Index your code
hub / github.com/python/cpython / doRollover

Method doRollover

Lib/logging/handlers.py:166–187  ·  view source on GitHub ↗

Do a rollover, as described in __init__().

(self)

Source from the content-addressed store, hash-verified

164 self.backupCount = backupCount
165
166 def doRollover(self):
167 """
168 Do a rollover, as described in __init__().
169 """
170 if self.stream:
171 self.stream.close()
172 self.stream = None
173 if self.backupCount > 0:
174 for i in range(self.backupCount - 1, 0, -1):
175 sfn = self.rotation_filename("%s.%d" % (self.baseFilename, i))
176 dfn = self.rotation_filename("%s.%d" % (self.baseFilename,
177 i + 1))
178 if os.path.exists(sfn):
179 if os.path.exists(dfn):
180 os.remove(dfn)
181 os.rename(sfn, dfn)
182 dfn = self.rotation_filename(self.baseFilename + ".1")
183 if os.path.exists(dfn):
184 os.remove(dfn)
185 self.rotate(self.baseFilename, dfn)
186 if not self.delay:
187 self.stream = self._open()
188
189 def shouldRollover(self, record):
190 """

Callers 1

emitMethod · 0.45

Calls 7

rotation_filenameMethod · 0.80
closeMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45
renameMethod · 0.45
rotateMethod · 0.45
_openMethod · 0.45

Tested by

no test coverage detected