// Stream method is for streaming the messages:
Stream method is for streaming the messages.
// Stream method is for streaming the messages :
func (adapter *Adapter) Stream(logstream chan *router.Message) {
	defer func(begin time.Time) {
		adapter.instrumenting.fireAddRequestCount(streamActionLabel)
		adapter.instrumenting.fireAddRequestLatency(begin, streamActionLabel)
	}(time.Now())
	for m := range logstream {
		if m.Data == "" {
			continue
		}
		messageStr, err := json.Marshal(Message{
			Message: m.Data,
			Container: ContainerInfo{
				Name: strings.Trim(m.Container.Name, "/"),
				ID:   m.Container.ID,
				Config: ContainerConfig{
					Image:    m.Container.Config.Image,
					Hostname: m.Container.Config.Hostname,
					Labels:   m.Container.Config.Labels,
				},
			},
			Level:    adapter.getLevel(m.Source),
			Hostname: adapter.getHost(m.Container.Config.Hostname),
			Tags:     adapter.getTags(m),
		})
		if err != nil {
			go adapter.instrumenting.fireAddStreamMarshalDataError()
			adapter.Logger.Println(
				fmt.Errorf(
					"JSON Marshalling Error: %s. Missing message data: %s",
					err.Error(),
					m.Data,
				),
			)
		} else {
			adapter.Queue <- Line{
				Line:      string(messageStr),
				File:      m.Container.Name,
				Timestamp: time.Now().Unix(),
			}
		}
	}
}
func ( adapter * Adapter ) Stream ( logstream chan * router . Message ) { defer func ( begin time . Time ) { adapter . instrumenting . fireAddRequestCount ( streamActionLabel ) adapter . instrumenting . fireAddRequestLatency ( begin , streamActionLabel ) } ( time . Now ( ) ) for m := range logstream { if m . Data == " " { continue } messageStr , err := json . Marshal ( Message { Message : m . Data , Container : ContainerInfo { Name : strings . Trim ( m . Container . Name , " " ) , ID : m . Container . ID , Config : ContainerConfig { Image : m . Container . Config . Image , Hostname : m . Container . Config . Hostname , Labels : m . Container . Config . Labels , } , } , Level : adapter . getLevel ( m . Source ) , Hostname : adapter . getHost ( m . Container . Config . Hostname ) , Tags : adapter . getTags ( m ) , } ) if err != nil { go adapter . instrumenting . fireAddStreamMarshalDataError ( ) adapter . Logger . Println ( fmt . Errorf ( " " , err . Error ( ) , m . Data , ) , ) } else { adapter . Queue <- Line { Line : string ( messageStr ) , File : m . Container . Name , Timestamp : time . Now ( ) . Unix ( ) , } } } }
Stream method is for streaming the messages.
Stream method is for streaming the messages .