MCPcopy Index your code
hub / github.com/RustPython/RustPython / shouldRollover

Method shouldRollover

Lib/logging/handlers.py:189–209  ·  view source on GitHub ↗

Determine if rollover should occur. Basically, see if the supplied record would cause the file to exceed the size limit we have.

(self, record)

Source from the content-addressed store, hash-verified

187 self.stream = self._open()
188
189 def shouldRollover(self, record):
190 """
191 Determine if rollover should occur.
192
193 Basically, see if the supplied record would cause the file to exceed
194 the size limit we have.
195 """
196 if self.stream is None: # delay was set...
197 self.stream = self._open()
198 if self.maxBytes > 0: # are we rolling over?
199 pos = self.stream.tell()
200 if not pos:
201 # gh-116263: Never rollover an empty file
202 return False
203 msg = "%s\n" % self.format(record)
204 if pos + len(msg) >= self.maxBytes:
205 # See bpo-45401: Never rollover anything other than regular files
206 if os.path.exists(self.baseFilename) and not os.path.isfile(self.baseFilename):
207 return False
208 return True
209 return False
210
211class TimedRotatingFileHandler(BaseRotatingHandler):
212 """

Callers 5

test_should_rolloverMethod · 0.95
test_max_bytesMethod · 0.95
emitMethod · 0.45

Calls 6

lenFunction · 0.85
_openMethod · 0.45
tellMethod · 0.45
formatMethod · 0.45
existsMethod · 0.45
isfileMethod · 0.45

Tested by 4

test_should_rolloverMethod · 0.76
test_max_bytesMethod · 0.76