def add_log_sink(self, log_sink):
    """Adds a LogSink to this LogSource.

    Adds a listening LogSink to this LogSource. If there any buffered messages,
    they are delegated synchronously to the added LogSink.

    Args:
      log_sink: A LogSink object capable of listening for LogSource messages.
    """
    if log_sink in self.log_sinks:
      return

    self.log_sinks.append(log_sink)
    for message in self.buffered_messages:
      log_sink.log({
        'log_level': message[0],
        'time': message[1],
        'name': message[2],
        'message': message[3]
      })
dataset/ETHPy150Open google/anvil-build/anvil/build_logging.py/LogSource.add_log_sink/original