MCPcopy
hub / github.com/sirupsen/logrus / TestEntryWithError

Function TestEntryWithError

entry_test.go:15–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13type contextKeyType string
14
15func TestEntryWithError(t *testing.T) {
16
17 assert := assert.New(t)
18
19 defer func() {
20 ErrorKey = "error"
21 }()
22
23 err := fmt.Errorf("kaboom at layer %d", 4711)
24
25 assert.Equal(err, WithError(err).Data["error"])
26
27 logger := New()
28 logger.Out = &bytes.Buffer{}
29 entry := NewEntry(logger)
30
31 assert.Equal(err, entry.WithError(err).Data["error"])
32
33 ErrorKey = "err"
34
35 assert.Equal(err, entry.WithError(err).Data["err"])
36
37}
38
39func TestEntryWithContext(t *testing.T) {
40 assert := assert.New(t)

Callers

nothing calls this directly

Calls 5

WithErrorMethod · 0.95
WithErrorFunction · 0.85
NewFunction · 0.85
NewEntryFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected