...
Source file
src/golang.org/x/exp/slog/example_logvaluer_group_test.go
1
2
3
4
5 package slog_test
6
7 import "golang.org/x/exp/slog"
8
9 type Name struct {
10 First, Last string
11 }
12
13
14
15
16 func (n Name) LogValue() slog.Value {
17 return slog.GroupValue(
18 slog.String("first", n.First),
19 slog.String("last", n.Last))
20 }
21
22 func ExampleLogValuer_group() {
23 n := Name{"Perry", "Platypus"}
24 slog.Info("mission accomplished", "agent", n)
25
26
27
28
29
30
31
32
33
34
35 }
36
View as plain text