(self, line_by_line=True, move_end=True)
Read line-by-line and run callback on each line.
        line_by_line: yield each time a callback has returned True
        move_end: start from the last line of the log
Read line-by-line and run callback on each line.
        line_by_line: yield each time a callback has returned True
        move_end: start from the last line of the log
Read line - by - line and run callback on each line . line_by_line : yield each time a callback has returned True move_end : start from the last line of the log
def tail(self, line_by_line=True, move_end=True):
        """Read line-by-line and run callback on each line.
        line_by_line: yield each time a callback has returned True
        move_end: start from the last line of the log"""
        try:
            self._open_file(move_end=move_end)

            while True:
                pos = self._f.tell()
                line = self._f.readline()
                if line:
                    line = line.strip(chr(0))  # a truncate may have create holes in the file
                    if self._callback(line.rstrip("\n")):
                        if line_by_line:
                            yield True
                            pos = self._f.tell()
                            self._open_file(move_end=False, pos=pos)
                        else:
                            continue
                    else:
                        continue
                else:
                    yield True
                    assert pos == self._f.tell()
                    self._open_file(move_end=False, pos=pos)

        except Exception as e:
            # log but survive
            self._log.exception(e)
            raise StopIteration(e)
def tail ( self , line_by_line = True , move_end = True ) : try : self . _open_file ( move_end = move_end ) while True : pos = self . _f . tell ( ) line = self . _f . readline ( ) if line : line = line . strip ( chr ( 0 ) ) # a truncate may have create holes in the file if self . _callback ( line . rstrip ( "\n" ) ) : if line_by_line : yield True pos = self . _f . tell ( ) self . _open_file ( move_end = False , pos = pos ) else : continue else : continue else : yield True assert pos == self . _f . tell ( ) self . _open_file ( move_end = False , pos = pos ) except Exception as e : # log but survive self . _log . exception ( e ) raise StopIteration ( e )