def fields_from_log(fh):
 rows = fh.read()
 row = rows.split('\n')[0]
 fields = []
 matches = re.search(TIMESTAMP_PATTERN, row)
 if matches:
  fields.append(('timestamp', 'tdate'))
 fields.append(('message', 'text_general'))
 return fields

def fields_from_log ( fh ) : rows = fh . read ( ) row = rows . split ( '\n' ) [ 0 ] fields = [ ] matches = re . search ( TIMESTAMP_PATTERN , row ) if matches : fields . append ( ( 'timestamp' , 'tdate' ) ) fields . append ( ( 'message' , 'text_general' ) ) return fields
only timestamp and message .