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

Function ExampleWriter

zapio/example_test.go:31–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29)
30
31func ExampleWriter() {
32 logger := zap.NewExample()
33 w := &zapio.Writer{Log: logger}
34
35 io.WriteString(w, "starting up\n")
36 io.WriteString(w, "running\n")
37 io.WriteString(w, "shutting down\n")
38
39 if err := w.Close(); err != nil {
40 log.Fatal(err)
41 }
42
43 // Output:
44 // {"level":"info","msg":"starting up"}
45 // {"level":"info","msg":"running"}
46 // {"level":"info","msg":"shutting down"}
47}

Callers

nothing calls this directly

Calls 4

CloseMethod · 0.95
NewExampleFunction · 0.92
WriteStringMethod · 0.80
FatalMethod · 0.45

Tested by

no test coverage detected