def emit(self, record):
"""
Emit a record.
Output the record to the file, catering for rollover as described
in setRollover().
"""
if self.maxBytes > 0: # are we rolling over?
msg = "%s\n" % self.format(record)
try:
self.stream.seek(0, 2) #due to non-posix-compliant Windows feature
if self.stream.tell() + len(msg) >= self.maxBytes:
self.doRollover()
except ValueError:
# on Windows we get "ValueError: I/O operation on closed file"
# when a second copy of workbench is run
self.doRollover()
logging.FileHandler.emit(self, record)
评论列表
文章目录