Documentation ¶
Overview ¶
Package testutil provide test utilities for testing common packages. Go doesn't support importing from _test files, so common test utilities have to be exported.
Index ¶
- type CapturedLogEntry
- type LogCapturer
- type Logger
- func (logger *Logger) Debug(message string, args ...interface{})
- func (*Logger) Error(message string, args ...interface{})
- func (*Logger) Info(message string, args ...interface{})
- func (logger *Logger) IsDebugEnabled() bool
- func (*Logger) Sync() error
- func (*Logger) Warn(message string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapturedLogEntry ¶
type CapturedLogEntry struct { Message string Arguments []interface{} }
CapturedLogEntry represents a captured log entry (for test purposes only).
type LogCapturer ¶
type LogCapturer struct { *Logger DebugCaptures []*CapturedLogEntry InfoCaptures []*CapturedLogEntry WarnCaptures []*CapturedLogEntry ErrorCaptures []*CapturedLogEntry }
LogCapturer is a logger that silently captures logs (for test purposes only).
func NewLogCapturer ¶
func NewLogCapturer(inDebugMode bool) *LogCapturer
NewLogCapturer creates a logger that silently captures logs (for test purposes only).
func (*LogCapturer) Debug ¶
func (logger *LogCapturer) Debug(message string, args ...interface{})
Debug captures a debug message.
func (*LogCapturer) Error ¶
func (logger *LogCapturer) Error(message string, args ...interface{})
Error captures an error message.
func (*LogCapturer) Info ¶
func (logger *LogCapturer) Info(message string, args ...interface{})
Info captures a informational message.
func (*LogCapturer) Warn ¶
func (logger *LogCapturer) Warn(message string, args ...interface{})
Warn captures a warning message.
type Logger ¶
type Logger struct {
InDebugMode bool
}
Logger is a logger for test purposes only.
func (*Logger) IsDebugEnabled ¶
IsDebugEnabled checks whether or not debug logging is enabled.