Documentation ¶
Index ¶
- func FilterEntries(logEntries []logrus.Entry, expLevel logrus.Level, expContents string) []logrus.Entry
- func LogContains(logEntries []logrus.Entry, expLevel logrus.Level, expContents string) bool
- func NewLogger(t testing.TB) logrus.FieldLogger
- func NewTestOutput(t testing.TB) io.Writer
- type SimpleLogrusHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterEntries ¶
func FilterEntries(logEntries []logrus.Entry, expLevel logrus.Level, expContents string) []logrus.Entry
FilterEntries is a helper function that checks the provided list of log entries for a messages matching the provided level and contents and returns an array with only them.
func LogContains ¶
LogContains is a helper function that checks the provided list of log entries for a message matching the provided level and contents.
Types ¶
type SimpleLogrusHook ¶
type SimpleLogrusHook struct { HookedLevels []logrus.Level // contains filtered or unexported fields }
SimpleLogrusHook implements the logrus.Hook interface and could be used to check if log messages were outputted
func NewLogHook ¶
func NewLogHook(levels ...logrus.Level) *SimpleLogrusHook
NewLogHook creates a new SimpleLogrusHook with the given levels and returns it. If no levels are specified, then logrus.AllLevels will be used.
func NewLoggerWithHook ¶
func NewLoggerWithHook(t testing.TB, levels ...logrus.Level) (logrus.FieldLogger, *SimpleLogrusHook)
NewLoggerWithHook calls NewLogger() and attaches a hook with the given levels. If no levels are specified, then logrus.AllLevels will be used and the lowest log level will be Debug.
func (*SimpleLogrusHook) Drain ¶
func (smh *SimpleLogrusHook) Drain() []logrus.Entry
Drain returns the currently stored messages and deletes them from the cache
func (*SimpleLogrusHook) Fire ¶
func (smh *SimpleLogrusHook) Fire(e *logrus.Entry) error
Fire saves whatever message the logrus library passed in the cache
func (*SimpleLogrusHook) LastEntry ¶
func (smh *SimpleLogrusHook) LastEntry() *logrus.Entry
LastEntry returns the last entry that was logged (or nil, if no messages were logged or remain).
func (*SimpleLogrusHook) Levels ¶
func (smh *SimpleLogrusHook) Levels() []logrus.Level
Levels just returns whatever was stored in the HookedLevels slice
func (*SimpleLogrusHook) Lines ¶
func (smh *SimpleLogrusHook) Lines() []string
Lines returns the logged lines.
func (*SimpleLogrusHook) Reset ¶
func (smh *SimpleLogrusHook) Reset()
Reset clears the internal entry buffer.
Directories ¶
Path | Synopsis |
---|---|
Package httpmultibin is indended only for use in tests, do not import in production code!
|
Package httpmultibin is indended only for use in tests, do not import in production code! |