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

Function TestHookFireOrder

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

Source from the content-addressed store, hash-verified

221}
222
223func TestHookFireOrder(t *testing.T) {
224 checkers := []string{}
225 h := LevelHooks{}
226 h.Add(&HookCallFunc{F: func() { checkers = append(checkers, "first hook") }})
227 h.Add(&HookCallFunc{F: func() { checkers = append(checkers, "second hook") }})
228 h.Add(&HookCallFunc{F: func() { checkers = append(checkers, "third hook") }})
229
230 if err := h.Fire(InfoLevel, &Entry{}); err != nil {
231 t.Error("unexpected error:", err)
232 }
233 require.Equal(t, []string{"first hook", "second hook", "third hook"}, checkers)
234}

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
FireMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…