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

Function Example_struct

example_test.go:46–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46func Example_struct() {
47 l := slog.Make(sloghuman.Sink(os.Stdout))
48
49 type hello struct {
50 Meow int `json:"meow"`
51 Bar string `json:"bar"`
52 M time.Time `json:"m"`
53 }
54
55 l.Info(context.Background(), "check out my structure",
56 slog.F("hello", hello{
57 Meow: 1,
58 Bar: "barbar",
59 M: time.Date(2000, time.February, 5, 4, 4, 4, 0, time.UTC),
60 }),
61 )
62
63 // 2019-12-16 17:31:51.769 [INFO] <example_test.go:56> check out my structure {"hello": {"meow": 1, "bar": "barbar", "m": "2000-02-05T04:04:04Z"}}
64}
65
66func Example_testing() {
67 // Provided by the testing package in tests.

Callers

nothing calls this directly

Calls 2

SinkFunction · 0.92
InfoMethod · 0.80

Tested by

no test coverage detected