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

Method With

sugar.go:114–116  ·  view source on GitHub ↗

With adds a variadic number of fields to the logging context. It accepts a mix of strongly-typed Field objects and loosely-typed key-value pairs. When processing pairs, the first element of the pair is used as the field key and the second as the field value. For example, sugaredLogger.With(

(args ...interface{})

Source from the content-addressed store, hash-verified

112// and execution continues. Passing an orphaned key triggers similar behavior:
113// panics in development and errors in production.
114func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger {
115 return &SugaredLogger{base: s.base.With(s.sweetenFields(args)...)}
116}
117
118// WithLazy adds a variadic number of fields to the logging context lazily.
119// The fields are evaluated only if the logger is further chained with [With]

Callers

nothing calls this directly

Calls 2

sweetenFieldsMethod · 0.95
WithMethod · 0.65

Tested by

no test coverage detected