func (r *AccessLogRecord) Emit(e emitter.Emitter) { if r.RouteEndpoint.ApplicationId != "" { b := r.makeRecord() message := b.String() log.Debugf("Logging to the loggregator: %s", message) e.Emit(r.RouteEndpoint.ApplicationId, message) } }
func (r *AccessLogRecord) Emit(e emitter.Emitter) { if r.RouteEndpoint == nil { return } if r.RouteEndpoint.ApplicationId == "" { return } recordBuffer := r.makeRecord() message := recordBuffer.String() log.Debugf("Logging to the loggregator: %s", message) e.Emit(r.RouteEndpoint.ApplicationId, message) }
func testEmitHelper(b *testing.B, e emitter.Emitter, received chan *[]byte, isEnvelope bool) { go func() { for { <-received } }() for _, fixture := range messageFixtures { startTime := time.Now().UnixNano() for i := 0; i < b.N; i++ { e.Emit("appid", fixture.message) } elapsedTime := float64(time.Now().UnixNano() - startTime) expected := fixture.getExpected(isEnvelope) if elapsedTime > expected { b.Errorf("Elapsed time for %s should have been below %vs, but was %vs", fixture.name, expected/SECOND, float64(elapsedTime)/SECOND) } } }