def emit(self, record): """ Emit a record. First check if the underlying file has changed between the given time, and if it has, close the old stream and reopen the file to get the current stream. """ current_time = int(time.time()) if current_time > self.lastRolloverAt and current_time < self.lastRolloverAt + 600: #TODO, at this time , we should watch the basefile if not os.path.exists(self.baseFilename): stat = None changed = 1 else: stat = os.stat(self.baseFilename) changed = (stat.st_dev != self.dev) or (stat.st_ino != self.ino) if changed and self.stream is not None: self.stream.flush() self.stream.close() self.stream = self._open() if stat is None: stat = os.stat(self.baseFilename) self.dev, self.ino = stat.st_dev, stat.st_ino BaseRotatingHandler.emit(self, record)
def emit(self, record): """PiCloud: Support for disabling""" if not self._disabled: BaseRotatingHandler.emit(self, record)