Documentation ¶
Overview ¶
logtest provides the ability to test logs
Usage:
func MyTestFunc(t *testing.T) { logs := logTest.NewLogRecorder(t) defer logs.Close() ..... if diff := logs.Diff(expected); diff != "" { t.Fatal("logs unexpected", diff); } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogRecorder ¶
LogRecorder holds the state
func NewLogRecorder ¶
func NewLogRecorder(t *testing.T) *LogRecorder
NewLogRecorder starts a new log recorder.
Logs must be stopped by calling Close() on the recorder
func (*LogRecorder) Entries ¶
func (l *LogRecorder) Entries() []log.F
Entries returns the log entries.
Click to show internal directories.
Click to hide internal directories.