MCPcopy
hub / github.com/uber-go/zap / WithLazy

Method WithLazy

sugar.go:129–131  ·  view source on GitHub ↗

WithLazy adds a variadic number of fields to the logging context lazily. The fields are evaluated only if the logger is further chained with [With] or is written to with any of the log level methods. Until that occurs, the logger may retain references to objects inside the fields, and logging will r

(args ...interface{})

Source from the content-addressed store, hash-verified

127// passing a non-string key panics, while in production it logs an error and skips the pair.
128// Passing an orphaned key has the same behavior.
129func (s *SugaredLogger) WithLazy(args ...interface{}) *SugaredLogger {
130 return &SugaredLogger{base: s.base.WithLazy(s.sweetenFields(args)...)}
131}
132
133// Level reports the minimum enabled level for this logger.
134//

Callers

nothing calls this directly

Calls 1

sweetenFieldsMethod · 0.95

Tested by

no test coverage detected