#NEWLINE# def readline( self ) : #NEWLINE# #INDENT# 'Generate each line of the log file.' #NEWLINE# old_position = self . log_history_ [ 'position' ] #NEWLINE# position = self . log_history_ [ 'position' ] #NEWLINE# partial_line = self . log_history_ [ 'partial_line' ] #NEWLINE# try : #NEWLINE# #INDENT# with open ( self . pathname_ ) as logfile : #NEWLINE# #INDENT# logfile . seek ( logfile ) #NEWLINE# while True : #NEWLINE# #INDENT# line = logfile . readline ( ) #NEWLINE# partial_line += line #NEWLINE# position = logfile . tell ( ) #NEWLINE# if ( position > self . log_history_ [ 'position' ] ) : #NEWLINE# #INDENT# self . log_history_ [ 'position' ] = position #NEWLINE# #UNINDENT# if partial_line . endswith ( '\n' ) : #NEWLINE# #INDENT# self . log_history_ [ 'partial_line' ] = '' #NEWLINE# ( yield partial_line ) #NEWLINE# partial_line = self . log_history_ [ 'partial_line' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . log_history_ [ 'partial_line' ] = partial_line #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if partial_line : #NEWLINE# #INDENT# ( yield partial_line ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except Exception as error : #NEWLINE# #INDENT# logging . error ( 'failed to processing file %s' , self . pathname_ ) #NEWLINE# raise error #NEWLINE# #UNINDENT# logging . debug ( 'processing file %s log %s bytes to position %s' , self . pathname_ , ( position - old_position ) , position )