def RecordFromLine(line):
  """Create the correct type of record based on what the line looks like.

  With the classic streaming API, we did not distinguish between a message
  that came through the logging infrastructure and one that came throught stderr
  or logservice.write but had been written to look like it came from logging.

  Note that this code does not provide 100% accuracy with the old stream
  service. In the past, they could have written:
    sys.stderr.write('LOG %d %d' % (level, time))
    sys.stderr.write(' %s' % message)
  and that would have magically turned into a single full record. Trying to
  handle every single corner case seems like a poor use of time.

  Args:
    line: a single line written to stderr or logservice.write.

  Returns:
    The appropriate type of record.
  """
  try:
    created, level, unused_source_location, message = (
        _StrictParseLogEntry(line, clean_message=False))


    message = Stripnl(message)
    return LoggingRecord(level, created, message, None)
  except __HOLE__:
    return StderrRecord(line)
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/logservice/logsutil.py/RecordFromLine