DebugLog is more efficient than level.Debug().Log(). Also it swallows the error return because nobody checks for errors on debug logs.
(kvps ...interface{})
| 156 | // DebugLog is more efficient than level.Debug().Log(). |
| 157 | // Also it swallows the error return because nobody checks for errors on debug logs. |
| 158 | func (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 | |
| 168 | func (s *SpanLogger) spanLog(kvps ...interface{}) error { |
| 169 | if !s.sampled { |