MCPcopy
hub / github.com/grafana/dskit / DebugLog

Method DebugLog

spanlogger/spanlogger.go:158–166  ·  view source on GitHub ↗

DebugLog is more efficient than level.Debug().Log(). Also it swallows the error return because nobody checks for errors on debug logs.

(kvps ...interface{})

Source from the content-addressed store, hash-verified

156// DebugLog is more efficient than level.Debug().Log().
157// Also it swallows the error return because nobody checks for errors on debug logs.
158func (s *SpanLogger) DebugLog(kvps ...interface{}) {
159 if s.debugEnabled {
160 // The call to Log() through an interface makes its argument escape, so make a copy here,
161 // in the debug-only path, so the function is faster for the non-debug path.
162 localCopy := append([]any{}, kvps...)
163 level.Debug(s.getLogger()).Log(localCopy...)
164 }
165 _ = s.spanLog(kvps...)
166}
167
168func (s *SpanLogger) spanLog(kvps ...interface{}) error {
169 if !s.sampled {

Callers 6

NewFunction · 0.95
NewOTelFunction · 0.95
BenchmarkSpanLoggerFunction · 0.80

Calls 3

getLoggerMethod · 0.95
spanLogMethod · 0.95
LogMethod · 0.45