8
// TestLogValues represents a single logging call.
9
type TestLogValues struct {
18
// TestWriter is a useful Writer for testing purposes. Each component of the
19
// logging message is stored in the Log array.
20
type TestWriter struct {
24
// Write saves the params as members in the TestLogValues struct appended to the Log array.
25
func (writer *TestWriter) Write(level Level, module, filename string, line int, timestamp time.Time, message string) {
26
if writer.Log == nil {
27
writer.Log = []TestLogValues{}
29
writer.Log = append(writer.Log,
30
TestLogValues{level, module, path.Base(filename), line, timestamp, message})
33
// Clear removes any saved log messages.
34
func (writer *TestWriter) Clear() {
35
writer.Log = []TestLogValues{}