// Record is used to set the function which will be triggered when new
// lnwire message was received.
336509
func (s *mockServer) intersect(f messageInterceptor) {
	s.interceptorFuncs = append(s.interceptorFuncs, f)
}
558126
func (lr *LogRecord) Log() {
	flowdebug.Log(lr.getLogFields(), "Logging flow record")

	// Lock while writing access log so we serialize writes as we may have
	// to reopen the logfile and parallel writes could fail because of that
	logMutex.Lock()
	defer logMutex.Unlock()

	lr.Metadata = metadata

	if notifier != nil {
		notifier.NewProxyLogRecord(lr)
	}

	if logger == nil {
		flowdebug.Log(log.WithField(FieldFilePath, logPath),
			"Skipping writing to access log (logger nil)")
		return
	}

	if _, err := logger.Write(lr.getRawLogMessage()); err != nil {
		log.WithError(err).WithField(FieldFilePath, logPath).
			Errorf("Error writing to access file")
	}
}
1030359
func (d *Domain) Records(name string) record.Manager {
	return record.New(d.Client, fmt.Sprintf("/domains/%s", name))
}
901671
func (m *RTMetrics) Record(code int, duration time.Duration) {
	m.total.Inc(1)
	if code == http.StatusGatewayTimeout || code == http.StatusBadGateway {
		m.netErrors.Inc(1)
	}
	m.recordStatusCode(code)
	m.recordLatency(duration)
}
1118899
func (s *Source) Record() (interface{}, error) {
	if s.MaxMsgs > 0 {
		s.numMsgs++
		if s.numMsgs > s.MaxMsgs {
			return nil, io.EOF
		}
	}
	msg, ok := <-s.consumer.Messages()
	if ok {
		var ret interface{}
		switch s.Type {
		case "json":
			parsed := make(map[string]interface{})
			err := json.Unmarshal(msg.Value, &parsed)
			if err != nil {
				return nil, errors.Wrap(err, "unmarshaling json")
			}
			ret = parsed
		case "raw":
			ret = msg
		default:
			return nil, errors.Errorf("unsupported kafka message type: '%v'", s.Type)
		}
		s.consumer.MarkOffset(msg, "") // mark message as processed
		return ret, nil
	}
	return nil, errors.New("messages channel closed")
}
676085
func (kl *Kubelet) recordNodeSchedulableEvent(node *v1.Node) error {
	kl.lastNodeUnschedulableLock.Lock()
	defer kl.lastNodeUnschedulableLock.Unlock()
	if kl.lastNodeUnschedulable != node.Spec.Unschedulable {
		if node.Spec.Unschedulable {
			kl.recordNodeStatusEvent(v1.EventTypeNormal, events.NodeNotSchedulable)
		} else {
			kl.recordNodeStatusEvent(v1.EventTypeNormal, events.NodeSchedulable)
		}
		kl.lastNodeUnschedulable = node.Spec.Unschedulable
	}
	return nil
}
694967
func (mock *AuditorServiceMock) Record(ctx context.Context, action, result string, params common.Params) error {
	newParams := params.Copy()
	if mock.RecordFunc == nil {
		panic("MockAuditor.RecordFunc is nil but MockAuditor.Record was just called")
	}

	callInfo := struct {
		Ctx    context.Context
		Action string
		Result string
		Params common.Params
	}{
		Ctx:    ctx,
		Action: action,
		Result: result,
		Params: newParams,
	}

	lockMockAuditorRecord.Lock()
	mock.calls.Record = append(mock.calls.Record, callInfo)
	lockMockAuditorRecord.Unlock()

	return mock.RecordFunc(ctx, action, result, newParams)
}
735840
func (history *History) Records() []interface{} {
	history.mu.Lock()
	defer history.mu.Unlock()

	records := make([]interface{}, 0, history.length)
	records = append(records, history.records[history.next:history.length]...)
	records = append(records, history.records[:history.next]...)

	// In place reverse.
	for i := 0; i < history.length/2; i++ {
		records[i], records[history.length-i-1] = records[history.length-i-1], records[i]
	}

	return records
}
795356
func (ll *ListLogHandler) Log(r *Record) (err error) {
	for _, handler := range ll.handlers {
		if err == nil {
			err = handler.Log(r)
		} else {
			handler.Log(r)
		}
	}
	return
}
750714
func (r *RecordList) Add(ev EventBuilder, fn Listener) int {
	idx, rec := r.Find(ev.Name())
	if idx == -1 {
		rec := &record{ev: ev, name: ev.Name()}
		rec.setList([]unsafe.Pointer{unsafe.Pointer(&fn)})
		r.append(rec)
		return 1
	}

	oldList := rec.getUnsafeList()
	newCount := len(oldList) - rec.inactiveItems + 1
	if rec.inactiveItems == 0 {
		rec.inactiveItems = len(oldList)
		newList := make([]unsafe.Pointer, len(oldList)*2+1)
		// copy so that the new list items are at the end of the list,
		// this lets the slot search later run and find free space faster.
		copy(newList[len(oldList)+1:], oldList)
		newList[len(oldList)] = unsafe.Pointer(&fn)
		rec.setList(newList)
		return newCount
	}

	for i, ptr := range oldList {
		if ptr == nil {
			rec.storeAtIndex(i, fn)
			rec.inactiveItems--
			return newCount
		}
	}

	panic("unreachable")
}
1164053
func (eventBroadcaster *eventBroadcasterImpl) NewRecorder(scheme *runtime.Scheme, source v1.EventSource) EventRecorder {
	return &recorderImpl{scheme, source, eventBroadcaster.Broadcaster, clock.RealClock{}}
}
727479
func (c *RPCClient) Recorded() bool {
	out := new(RecordedOut)
	c.call("Recorded", RecordedIn{}, out)
	return out.Recorded
}
835163
func (h *PCPHistogram) RecordN(val, n int64) error {
	h.mutex.Lock()
	defer h.mutex.Unlock()

	err := h.h.RecordValues(val, n)
	if err != nil {
		return err
	}

	return h.update()
}
1135862
func (res *Resolver) records() *records.RecordGenerator {
	res.rsLock.RLock()
	defer res.rsLock.RUnlock()
	return res.rs
}
535811
func (c *Connection) log(v ...interface{}) {
	logLock.Lock()
	defer logLock.Unlock()
	if c.logger == nil {
		return
	}
	_, fn, ld, ok := runtime.Caller(1)

	if ok {
		c.logger.Printf("%s %s %d %v\n", c.session, fn, ld, v)
	} else {
		c.logger.Printf("%s %v\n", c.session, v)
	}
	return
}
1009809
func (log Logger) Log(lvl Level, source, message string) {
	skip := true

	// Determine if any logging will be done
	for _, filt := range log {
		if lvl >= filt.Level {
			skip = false
			break
		}
	}
	if skip {
		return
	}

	// Make the log record
	rec := &LogRecord{
		Level:   lvl,
		Created: time.Now(),
		Source:  source,
		Message: message,
	}

	// Dispatch the logs
	for _, filt := range log {
		if lvl < filt.Level {
			continue
		}
		filt.LogWrite(rec)
	}
}
528134
func (l *DefaultLogger) Trace(msg string, args ...interface{}) {
	l.Log(LevelTrace, msg, args)
}