...
Source file
src/cdr.dev/slog/example_helper_test.go
1 package slog_test
2
3 import (
4 "context"
5 "net/http"
6 "os"
7
8 "cdr.dev/slog"
9 "cdr.dev/slog/sloggers/sloghuman"
10 )
11
12 func httpLogHelper(ctx context.Context, status int) {
13 slog.Helper()
14
15 l.Info(ctx, "sending HTTP response",
16 slog.F("status", status),
17 )
18 }
19
20 var l = slog.Make(sloghuman.Sink(os.Stdout))
21
22 func ExampleHelper() {
23 ctx := context.Background()
24 httpLogHelper(ctx, http.StatusBadGateway)
25
26
27 }
28
View as plain text