def process_input(input, logfile, log_timestamp_format=None, alert_hooks=()):
 while True:
  line = input.readline()
  if (len(line) == 0):
   write_logline(logfile, TERM_MSG, log_timestamp_format)
   break
  if (line == '\n'):
   continue
  write_logline(logfile, line, log_timestamp_format)
  for (regex, callback) in alert_hooks:
   match = re.match(regex, line.strip())
   if match:
    callback(*match.groups())

def process_input ( input , logfile , log_timestamp_format = None , alert_hooks = ( ) ) : while True : line = input . readline ( ) if ( len ( line ) == 0 ) : write_logline ( logfile , TERM_MSG , log_timestamp_format ) break if ( line == '\n' ) : continue write_logline ( logfile , line , log_timestamp_format ) for ( regex , callback ) in alert_hooks : match = re . match ( regex , line . strip ( ) ) if match : callback ( * match . groups ( ) )
continuously read lines from input stream and: - write them to log .