func (dt *DogTracer) listen() {
	dt.wg.Add(1)
	var event model.ProbeEvent
	var ok bool
	for {
		select {
		case <-dt.stop:
			dt.wg.Done()
			return
		case event, ok = <-dt.EventChan:
			if !ok {
				dt.wg.Done()
				return
			}
			// Send to Datadog
			data, err := json.Marshal(event)
			if err != nil {
				dogLogger.Errorf("couldn't marshal event type: %v\n", event.GetEventType())
				continue
			}
			if _, err := dt.conn.Write(data); err != nil {
				dogLogger.Errorf("couldn't send event to the agent: %v", err)
			}
		}
	}
}
// listen - Wait for events and print them
Wait for events and print them
// listen - Wait for events and print them
func (dt *DogTracer) listen() {
	dt.wg.Add(1)
	var event model.ProbeEvent
	var ok bool
	for {
		select {
		case <-dt.stop:
			dt.wg.Done()
			return
		case event, ok = <-dt.EventChan:
			if !ok {
				dt.wg.Done()
				return
			}
			data, err := json.Marshal(event)
			if err != nil {
				dogLogger.Errorf("couldn't marshal event type: %v\n", event.GetEventType())
				continue
			}
			if _, err := dt.conn.Write(data); err != nil {
				dogLogger.Errorf("couldn't send event to the agent: %v", err)
			}
		}
	}
}
func ( dt * DogTracer ) listen ( ) { dt . wg . Add ( 1 ) var event model . ProbeEvent var ok bool for { select { case <- dt . stop : dt . wg . Done ( ) return case event , ok = <- dt . EventChan : if ! ok { dt . wg . Done ( ) return } data , err := json . Marshal ( event ) if err != nil { dogLogger . Errorf ( " \n " , event . GetEventType ( ) ) continue } if _ , err := dt . conn . Write ( data ) ; err != nil { dogLogger . Errorf ( " " , err ) } } } }
Wait for events and print them
Wait for events and print them
// Send to Datadog