def next(self):
        """Get next line, adjust for year rollover and hint datetime format."""
        # use readline here because next() iterator uses internal readahead
        # buffer so seek position is wrong
        line = self.filehandle.readline()
        line = line.decode('utf-8', 'replace')
        if line == '':
            raise StopIteration
        line = line.rstrip('\n')
        le = LogEvent(line)

        # hint format and nextpos from previous line
        if self._datetime_format and self._datetime_nextpos is not None:
            ret = le.set_datetime_hint(self._datetime_format,
                                       self._datetime_nextpos,
                                       self.year_rollover)
            if not ret:
                # logevent indicates timestamp format has changed,
                # invalidate hint info
                self._datetime_format = None
                self._datetime_nextpos = None
        elif le.datetime:
            # gather new hint info from another logevent
            self._datetime_format = le.datetime_format
            self._datetime_nextpos = le._datetime_nextpos

        return le
def next ( self ) : line = self . filehandle . readline ( ) line = line . decode ( 'utf-8' , 'replace' ) if line == '' : raise StopIteration line = line . rstrip ( '\n' ) le = LogEvent ( line ) if self . _datetime_format and self . _datetime_nextpos is not None : ret = le . set_datetime_hint ( self . _datetime_format , self . _datetime_nextpos , self . year_rollover ) if not ret : self . _datetime_format = None self . _datetime_nextpos = None elif le . datetime : self . _datetime_format = le . datetime_format self . _datetime_nextpos = le . _datetime_nextpos return le
Get next line, adjust for year rollover and hint datetime format.