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

Function TestHookCanModifyEntry

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

Source from the content-addressed store, hash-verified

70}
71
72func TestHookCanModifyEntry(t *testing.T) {
73 hook := new(ModifyHook)
74
75 LogAndAssertJSON(t, func(log *Logger) {
76 log.Hooks.Add(hook)
77 log.WithField("wow", "elephant").Print("test")
78 }, func(fields Fields) {
79 assert.Equal(t, "whale", fields["wow"])
80 })
81}
82
83func TestCanFireMultipleHooks(t *testing.T) {
84 hook1 := new(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