Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileLogger ¶
FileLogger is a simple, thread-safe logger that logs to a tempFile and is intended for use in testing.
func NewFileLogger ¶
func NewFileLogger(t *testing.T) *FileLogger
NewFileLogger create a Logger using the name of the test as the filename.
func NewFileLoggerCustom ¶
func NewFileLoggerCustom(t *testing.T, fileName string) *FileLogger
NewFileLoggerCustom create a Logger using the given filename.
func (*FileLogger) Debug ¶
func (f *FileLogger) Debug(msg string, keyvals ...interface{})
Debug prints a debug message.
func (*FileLogger) Error ¶
func (f *FileLogger) Error(msg string, keyvals ...interface{})
Error prints an error message.
func (*FileLogger) Info ¶
func (f *FileLogger) Info(msg string, keyvals ...interface{})
Info prints an info message.
func (*FileLogger) With ¶
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.