Documentation
¶
Index ¶
- type TestLogger
- func (t *TestLogger) Bytes() []byte
- func (t *TestLogger) CallCount() int
- func (t *TestLogger) Debug(msg ...interface{})
- func (t *TestLogger) Debugf(format string, args ...interface{})
- func (t *TestLogger) Error(msg ...interface{})
- func (t *TestLogger) Errorf(format string, args ...interface{})
- func (t *TestLogger) Info(msg ...interface{})
- func (t *TestLogger) Infof(format string, args ...interface{})
- func (t *TestLogger) Reset()
- func (t *TestLogger) Warn(msg ...interface{})
- func (t *TestLogger) Warnf(format string, args ...interface{})
- func (t *TestLogger) WithFields(fields log.Fields) log.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
TestLogger is used to capture logs during the execution of a test. It writes the logs to a byte buffer which can be dumped and inspected. It also tracks a call count of the total number of times the logger has been called. Note that this logger is not meant to be used in production. It is meant only for tests.
func (*TestLogger) Bytes ¶
func (t *TestLogger) Bytes() []byte
Bytes returns all bytes of the log buffer
func (*TestLogger) CallCount ¶
func (t *TestLogger) CallCount() int
CallCount returns the number of times this logger was called
func (*TestLogger) Debugf ¶
func (t *TestLogger) Debugf(format string, args ...interface{})
Debugf log message with formatting
func (*TestLogger) Errorf ¶
func (t *TestLogger) Errorf(format string, args ...interface{})
Errorf log message with formatting
func (*TestLogger) Infof ¶
func (t *TestLogger) Infof(format string, args ...interface{})
Infof log message with formatting
func (*TestLogger) Warnf ¶
func (t *TestLogger) Warnf(format string, args ...interface{})
Warnf log message with formatting
func (*TestLogger) WithFields ¶
func (t *TestLogger) WithFields(fields log.Fields) log.Logger
WithFields will return a new logger based on the original logger with the additional supplied fields