WithLazy creates a child logger and adds structured context to it 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
(fields ...Field)
| 200 | // |
| 201 | // Similar to [With], fields added to the child don't affect the parent, and vice versa. |
| 202 | func (log *Logger) WithLazy(fields ...Field) *Logger { |
| 203 | if len(fields) == 0 { |
| 204 | return log |
| 205 | } |
| 206 | return log.WithOptions(WrapCore(func(core zapcore.Core) zapcore.Core { |
| 207 | return zapcore.NewLazyWith(core, fields) |
| 208 | })) |
| 209 | } |
| 210 | |
| 211 | // Level reports the minimum enabled level for this logger. |
| 212 | // |
nothing calls this directly
no test coverage detected