MCPcopy Create free account
hub / github.com/Shopify/goose / ExampleWithField

Function ExampleWithField

logger/loggable_test.go:12–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func ExampleWithField() {
13 ctx := context.Background()
14 ctx = WithField(ctx, "foo", "bar")
15
16 log := New("testing")
17
18 // Typically called as log(ctx, nil).Debug("the message")
19 entry := log(ctx, nil)
20 fmt.Printf("%+v", entry.Data["foo"])
21
22 // Output:
23 // bar
24}
25
26func ExampleWithFields() {
27 ctx := context.Background()

Callers

nothing calls this directly

Calls 2

WithFieldFunction · 0.85
NewFunction · 0.70

Tested by

no test coverage detected