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

Function Namespace

field.go:335–337  ·  view source on GitHub ↗

Namespace creates a named, isolated scope within the logger's context. All subsequent fields will be added to the new namespace. This helps prevent key collisions when injecting loggers into sub-components or third-party libraries.

(key string)

Source from the content-addressed store, hash-verified

333// This helps prevent key collisions when injecting loggers into sub-components
334// or third-party libraries.
335func Namespace(key string) Field {
336 return Field{Key: key, Type: zapcore.NamespaceType}
337}
338
339// Stringer constructs a field with the given key and the output of the value's
340// String method. The Stringer's String method is called lazily.

Callers 5

ExampleNamespaceFunction · 0.92
appendGroupsMethod · 0.92
TestFiltersFunction · 0.92
TestFieldConstructorsFunction · 0.85

Calls

no outgoing calls

Tested by 4

ExampleNamespaceFunction · 0.74
TestFiltersFunction · 0.74
TestFieldConstructorsFunction · 0.68