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

Function ExampleLogger_Named

example_test.go:110–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108}
109
110func ExampleLogger_Named() {
111 ctx := context.Background()
112
113 l := slog.Make(sloghuman.Sink(os.Stdout))
114 l = l.Named("http")
115 l.Info(ctx, "received request", slog.F("remote address", net.IPv4(127, 0, 0, 1)))
116
117 // 2019-12-07 21:20:56.974 [INFO] (http) received request remote_address=127.0.0.1}
118}
119
120func ExampleLogger_Leveled() {
121 ctx := context.Background()

Callers

nothing calls this directly

Calls 3

SinkFunction · 0.92
NamedMethod · 0.80
InfoMethod · 0.80

Tested by

no test coverage detected