test

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2018 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

The Test package is used for testing logrus. It is here for backwards compatibility from when logrus' organization was upper-case. Please use lower-case logrus and the `null` package instead of this one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	// Entries is an array of all entries that have been received by this hook.
	// For safe access, use the AllEntries() method, rather than reading this
	// value directly.
	Entries []logrus.Entry
	// contains filtered or unexported fields
}

Hook is a hook designed for dealing with logs in test scenarios.

func NewGlobal

func NewGlobal() *Hook

NewGlobal installs a test hook for the global logger.

func NewLocal

func NewLocal(logger *logrus.Logger) *Hook

NewLocal installs a test hook for a given local logger.

func NewNullLogger

func NewNullLogger() (*logrus.Logger, *Hook)

NewNullLogger creates a discarding logger and installs the test hook.

func (*Hook) AllEntries added in v1.0.0

func (t *Hook) AllEntries() []*logrus.Entry

AllEntries returns all entries that were logged.

func (*Hook) Fire

func (t *Hook) Fire(e *logrus.Entry) error

func (*Hook) LastEntry

func (t *Hook) LastEntry() *logrus.Entry

LastEntry returns the last entry that was logged or nil.

func (*Hook) Levels

func (t *Hook) Levels() []logrus.Level

func (*Hook) Reset

func (t *Hook) Reset()

Reset removes all Entries from this test hook.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL