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

Function ExampleWithFields

logger/loggable_test.go:26–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26func ExampleWithFields() {
27 ctx := context.Background()
28 ctx = WithFields(ctx, logrus.Fields{
29 "foo": "bar",
30 })
31
32 log := New("testing")
33
34 // Typically called as log(ctx, nil).Debug("the message")
35 entry := log(ctx, nil)
36 fmt.Printf("%+v", entry.Data["foo"])
37
38 // Output:
39 // bar
40}
41
42type exampleLoggable logrus.Fields
43

Callers

nothing calls this directly

Calls 2

WithFieldsFunction · 0.85
NewFunction · 0.70

Tested by

no test coverage detected