Documentation ¶
Overview ¶
The testlogrus packages exposes two functions to use during testing.
When calling `Logs` function, the logs are reset, as such if multiple verification are to be done, you should first affect `Logs` result to a variable.
func TestSome(t *testing.T) { t.Run("error_test", func(t *testing.T) { // Arrange testlogrus.CatchLogs() // Act // call some functions that log with logrus // Assert logs := testlogrus.Logs() // assert some things around function expected logs }) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoHook = errors.New("testlogrus hook wasn't initialized with CatchLogs")
ErrNoHook is the panic error in case Logs is called without a previous call to CatchLogs.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.