MCPcopy Index your code
hub / github.com/coder/slog / ExampleWith

Function ExampleWith

example_test.go:92–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90}
91
92func ExampleWith() {
93 ctx := slog.With(context.Background(), slog.F("field", 1))
94
95 l := slog.Make(sloghuman.Sink(os.Stdout))
96 l.Info(ctx, "msg")
97
98 // 2019-12-07 20:54:23.986 [INFO] msg field=1}
99}
100
101func ExampleStdlib() {
102 ctx := slog.With(context.Background(), slog.F("field", 1))

Callers

nothing calls this directly

Calls 3

SinkFunction · 0.92
WithMethod · 0.80
InfoMethod · 0.80

Tested by

no test coverage detected