Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileLogger ¶ added in v0.10.1
FileLogger is a simple, thread-safe logger that logs to a tempFile and is intended for use in testing.
func NewFileLogger ¶ added in v0.10.1
func NewFileLogger(t *testing.T) *FileLogger
NewLogger create a Logger using the name of the test as the filename.
func NewFileLoggerCustom ¶ added in v0.10.1
func NewFileLoggerCustom(t *testing.T, fileName string) *FileLogger
NewLoggerCustom create a Logger using the given filename.
func (*FileLogger) Debug ¶ added in v0.10.1
func (f *FileLogger) Debug(msg string, keyvals ...interface{})
Debug prints a debug message.
func (*FileLogger) Error ¶ added in v0.10.1
func (f *FileLogger) Error(msg string, keyvals ...interface{})
Error prints an error message.
func (*FileLogger) Info ¶ added in v0.10.1
func (f *FileLogger) Info(msg string, keyvals ...interface{})
Info prints an info message.
func (*FileLogger) With ¶ added in v0.10.1
func (f *FileLogger) With(keyvals ...interface{}) log.Logger
With returns a new Logger with the given keyvals added.
type Logger ¶
Logger is a simple, yet thread-safe, logger intended for use in unit tests.
type MockLogger ¶
type MockLogger struct {
DebugLines, InfoLines, ErrLines []string
}
MockLogger is a fake logger that accumulates all the inputs.
It can be used in tests to ensure that certain messages was logged with correct severity.
func (*MockLogger) Debug ¶
func (t *MockLogger) Debug(msg string, keyvals ...interface{})
Debug saves a debug message.
func (*MockLogger) Error ¶
func (t *MockLogger) Error(msg string, keyvals ...interface{})
Error saves an error message.
func (*MockLogger) Info ¶
func (t *MockLogger) Info(msg string, keyvals ...interface{})
Info saves an info message.