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

Function ExampleLogger_Check

example_test.go:289–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287}
288
289func ExampleLogger_Check() {
290 logger := zap.NewExample()
291 defer logger.Sync()
292
293 if ce := logger.Check(zap.DebugLevel, "debugging"); ce != nil {
294 // If debug-level log output isn't enabled or if zap's sampling would have
295 // dropped this log entry, we don't allocate the slice that holds these
296 // fields.
297 ce.Write(
298 zap.String("foo", "bar"),
299 zap.String("baz", "quux"),
300 )
301 }
302
303 // Output:
304 // {"level":"debug","msg":"debugging","foo":"bar","baz":"quux"}
305}
306
307func ExampleLogger_Named() {
308 logger := zap.NewExample()

Callers

nothing calls this directly

Calls 5

NewExampleFunction · 0.92
StringFunction · 0.92
SyncMethod · 0.65
CheckMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected