diff --git a/lib/testutils/logrus_hook.go b/lib/testutils/logrus_hook.go index 47465bae4828..54ce80af7673 100644 --- a/lib/testutils/logrus_hook.go +++ b/lib/testutils/logrus_hook.go @@ -37,6 +37,16 @@ func (smh *SimpleLogrusHook) Drain() []logrus.Entry { return res } +// Lines returns the logged lines. +func (smh *SimpleLogrusHook) Lines() []string { + entries := smh.Drain() + lines := make([]string, len(entries)) + for i, entry := range entries { + lines[i] = entry.Message + } + return lines +} + var _ logrus.Hook = &SimpleLogrusHook{} // LogContains is a helper function that checks the provided list of log entries