<s> """<STR_LIT>""" <EOL> import os <EOL> import time <EOL> REQUEST_KEY = '<STR_LIT>' <EOL> def RequestID ( ) : <EOL> """<STR_LIT>""" <EOL> return os . environ . get ( REQUEST_KEY , None ) <EOL> def ParseLogEntry ( entry ) : <EOL> """<STR_LIT>""" <EOL> split = entry . split ( '<STR_LIT:U+0020>' , <NUM_LIT:3> ) <EOL> if len ( split ) == <NUM_LIT:4> and split [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> level = split [ <NUM_LIT:1> ] <EOL> timestamp = split [ <NUM_LIT:2> ] <EOL> message = split [ <NUM_LIT:3> ] <EOL> try : <EOL> message = str ( message ) <EOL> timestamp = int ( timestamp ) <EOL> level = int ( level ) <EOL> except ValueError : <EOL> pass <EOL> else : <EOL> if <NUM_LIT:0> <= level <= <NUM_LIT:4> : <EOL> return timestamp , level , message . replace ( '<STR_LIT>' , '<STR_LIT:\n>' ) <EOL> usec = int ( time . time ( ) * <NUM_LIT> ) <EOL> return usec , <NUM_LIT:3> , entry . replace ( '<STR_LIT>' , '<STR_LIT:\n>' ) <EOL> def ParseLogs ( logs ) : <EOL> """<STR_LIT>""" <EOL> return [ ParseLogEntry ( line ) for line in logs . split ( '<STR_LIT:\n>' ) if line ] </s>
