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

Function TestCanFireMultipleHooks

hook_test.go:83–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

81}
82
83func TestCanFireMultipleHooks(t *testing.T) {
84 hook1 := new(ModifyHook)
85 hook2 := new(TestHook)
86
87 LogAndAssertJSON(t, func(log *Logger) {
88 log.Hooks.Add(hook1)
89 log.Hooks.Add(hook2)
90
91 log.WithField("wow", "elephant").Print("test")
92 }, func(fields Fields) {
93 assert.Equal(t, "whale", fields["wow"])
94 assert.True(t, hook2.Fired)
95 })
96}
97
98type SingleLevelModifyHook struct {
99 ModifyHook

Callers

nothing calls this directly

Calls 4

LogAndAssertJSONFunction · 0.85
AddMethod · 0.80
PrintMethod · 0.65
WithFieldMethod · 0.65

Tested by

no test coverage detected