code: func (a *Adapter) Stream(logstream chan *router.Message) {
  	wg := sync.WaitGroup{}
  	wg.Add(1)
  	go func() {
  		a.subAdapter.Stream(a.out)
  		wg.Done()
  	}()
  	defer func() {
  		for _, message := range a.buffers {
  			a.out <- message
  		}
  
  		close(a.out)
  		wg.Wait()
  	}()
  
  	for {
  		select {
  		case message, ok := <-logstream:
  			if !ok {
  				return
  			}
  
  			if !multilineContainer(message.Container, a.enableByDefault) {
  				a.out <- message
  				continue
  			}
  
  			cID := message.Container.ID
  			old, oldExists := a.buffers[cID]
  			if a.isFirstLine(message) {
  				if oldExists {
  					a.out <- old
  				}
  
  				a.buffers[cID] = message
  			} else {
  				isLastLine := a.isLastLine(message)
  				
  				if oldExists {
  					old.Data += a.separator + message.Data
  					message = old
  				}
  
  				if isLastLine {
  					a.out <- message
  					if oldExists {
  						delete(a.buffers, cID)
  					}
  				} else {
  					a.buffers[cID] = message
  				}
  			}
  		case <-a.nextCheck:
  			now := time.Now()
  
  			for key, message := range a.buffers {
  				if message.Time.Add(a.flushAfter).After(now) {
  					a.out <- message
  					delete(a.buffers, key)
  				}
  			}
  
  			a.nextCheck = time.After(a.checkInterval)
  		}
  	}
  }
docs: // Stream sends log data to the next adapter