MCPcopy Create free account
hub / github.com/coder/slog / ExampleLogger_Leveled

Function ExampleLogger_Leveled

example_test.go:120–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118}
119
120func ExampleLogger_Leveled() {
121 ctx := context.Background()
122
123 l := slog.Make(sloghuman.Sink(os.Stdout))
124 l.Debug(ctx, "testing1")
125 l.Info(ctx, "received request")
126
127 l = l.Leveled(slog.LevelDebug)
128
129 l.Debug(ctx, "testing2")
130
131 // 2019-12-07 21:26:20.945 [INFO] received request
132 // 2019-12-07 21:26:20.945 [DEBU] testing2
133}

Callers

nothing calls this directly

Calls 4

SinkFunction · 0.92
DebugMethod · 0.80
InfoMethod · 0.80
LeveledMethod · 0.80

Tested by

no test coverage detected