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

Function ExampleNamespace

example_test.go:153–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151}
152
153func ExampleNamespace() {
154 logger := zap.NewExample()
155 defer logger.Sync()
156
157 logger.With(
158 zap.Namespace("metrics"),
159 zap.Int("counter", 1),
160 ).Info("tracked some metrics")
161 // Output:
162 // {"level":"info","msg":"tracked some metrics","metrics":{"counter":1}}
163}
164
165type addr struct {
166 IP string

Callers

nothing calls this directly

Calls 6

NewExampleFunction · 0.92
NamespaceFunction · 0.92
IntFunction · 0.92
SyncMethod · 0.65
WithMethod · 0.65
InfoMethod · 0.45

Tested by

no test coverage detected