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

Method Named

logger.go:154–165  ·  view source on GitHub ↗

Named adds a new path segment to the logger's name. Segments are joined by periods. By default, Loggers are unnamed.

(s string)

Source from the content-addressed store, hash-verified

152// Named adds a new path segment to the logger's name. Segments are joined by
153// periods. By default, Loggers are unnamed.
154func (log *Logger) Named(s string) *Logger {
155 if s == "" {
156 return log
157 }
158 l := log.clone()
159 if log.name == "" {
160 l.name = s
161 } else {
162 l.name = strings.Join([]string{l.name, s}, ".")
163 }
164 return l
165}
166
167// WithOptions clones the current Logger, applies the supplied Options, and
168// returns the resulting Logger. It's safe to use concurrently.

Callers 3

TestGlobalsConcurrentUseFunction · 0.45
TestLoggerNamesFunction · 0.45
ExampleLogger_NamedFunction · 0.45

Calls 1

cloneMethod · 0.95

Tested by 3

TestGlobalsConcurrentUseFunction · 0.36
TestLoggerNamesFunction · 0.36
ExampleLogger_NamedFunction · 0.36