<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def emit(self, record):
 """Save a logging.LogRecord to our test record. Logs carry useful metadata such as the logger name and level information. We capture this in a structured format in the test record to enable filtering by client applications. Args: record: A logging.LogRecord to record. """

    try:
      message = self.format(record)
      log_record = LogRecord(
          record.levelno, record.name, os.path.basename(record.pathname),
          record.lineno, int(record.created * 1000), message,
      )
      self._test_record.add_log_record(log_record)
      self._notify_update()
    except Exception:  # pylint: disable=broad-except
      self.handleError(record)