code: func (l *LogWriter) RegisterHandler(lh LogHandler) {
  	l.Lock()
  	defer l.Unlock()
  
  	// Do nothing if already registered
  	if _, ok := l.handlers[lh]; ok {
  		return
  	}
  
  	// Register
  	l.handlers[lh] = struct{}{}
  
  	// Send the old logs
  	if l.logs[l.index] != "" {
  		for i := l.index; i < len(l.logs); i++ {
  			lh.HandleLog(l.logs[i])
  		}
  	}
  	for i := 0; i < l.index; i++ {
  		lh.HandleLog(l.logs[i])
  	}
  }
docs: // RegisterHandler adds a log handler to receive logs, and sends
  // the last buffered logs to the handler