def read_lines(self, file_path, empty_lines=False, signal_ready=True):
        """Fetch lines from file.

        In case the file handler changes (logrotate), reopen the file.

        :param file_path: Path to file
        :param empty_lines: Return empty lines
        :param signal_ready: Report signal ready on start
        """
        file_handler, file_id = self._get_file(file_path)
        file_handler.seek(0, os.SEEK_END)

        if signal_ready:
            self.signal_ready()

        while self.thread_server.is_alive():
            line = six.text_type(file_handler.readline(), "utf-8")
            if line:
                yield line
                continue
            elif empty_lines:
                yield line

            time.sleep(0.1)

            if file_id != self._get_file_id(os.stat(file_path)) and os.path.isfile(file_path):
                file_handler, file_id = self._get_file(file_path)
def read_lines ( self , file_path , empty_lines = False , signal_ready = True ) : file_handler , file_id = self . _get_file ( file_path ) file_handler . seek ( 0 , os . SEEK_END ) if signal_ready : self . signal_ready ( ) while self . thread_server . is_alive ( ) : line = six . text_type ( file_handler . readline ( ) , "utf-8" ) if line : yield line continue elif empty_lines : yield line time . sleep ( 0.1 ) if file_id != self . _get_file_id ( os . stat ( file_path ) ) and os . path . isfile ( file_path ) : file_handler , file_id = self . _get_file ( file_path )
Fetch lines from file.

        In case the file handler changes (logrotate), reopen the file.

        :param file_path: Path to file
        :param empty_lines: Return empty lines
        :param signal_ready: Report signal ready on start