Documentation ¶
Overview ¶
A common logging interface used throughout the code which has implementations using stdout and AWS cloudwatch. Log levels are settable (DEBUG, INFO, ERROR) and there are implementations which provide less verbosity for use in things like Example unit tests.
Index ¶
- func GetLogLevelName(level LogLevel) (string, error)
- func HandlePanicWithLog(withLog ILogger)
- type ILogger
- type LogLevel
- type NullLogger
- func (l *NullLogger) Close()
- func (l *NullLogger) Debugf(format string, a ...interface{})
- func (l *NullLogger) Errorf(format string, a ...interface{})
- func (l *NullLogger) GetLogLevel() LogLevel
- func (l *NullLogger) Infof(format string, a ...interface{})
- func (l *NullLogger) Printf(level LogLevel, format string, a ...interface{})
- func (l *NullLogger) SetLogLevel(level LogLevel)
- type StdOutLogger
- func (l *StdOutLogger) Close()
- func (l *StdOutLogger) Debugf(format string, a ...interface{})
- func (l *StdOutLogger) Errorf(format string, a ...interface{})
- func (l *StdOutLogger) GetLogLevel() LogLevel
- func (l *StdOutLogger) Infof(format string, a ...interface{})
- func (l *StdOutLogger) Printf(level LogLevel, format string, a ...interface{})
- func (l *StdOutLogger) SetLogLevel(level LogLevel)
- type StdOutLoggerForTest
- func (l *StdOutLoggerForTest) Close()
- func (l *StdOutLoggerForTest) Debugf(format string, a ...interface{})
- func (l *StdOutLoggerForTest) Errorf(format string, a ...interface{})
- func (l *StdOutLoggerForTest) GetLogLevel() LogLevel
- func (l *StdOutLoggerForTest) Infof(format string, a ...interface{})
- func (l *StdOutLoggerForTest) LastLogLine() string
- func (l *StdOutLoggerForTest) LogContains(txt string) bool
- func (l *StdOutLoggerForTest) Printf(level LogLevel, format string, a ...interface{})
- func (l *StdOutLoggerForTest) SetLogLevel(level LogLevel)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogLevelName ¶
func HandlePanicWithLog ¶
func HandlePanicWithLog(withLog ILogger)
This can be called from anywhere that wants to handle a panic gracefully and ensure that any logging is done (eg completing sending to cloudwatch)
Types ¶
type ILogger ¶
type ILogger interface { Printf(level LogLevel, format string, a ...interface{}) Debugf(format string, a ...interface{}) Infof(format string, a ...interface{}) Errorf(format string, a ...interface{}) SetLogLevel(level LogLevel) GetLogLevel() LogLevel Close() }
ILogger - Generic logger interface
type NullLogger ¶
type NullLogger struct { }
NullLogger - For mocking out in tests
func (*NullLogger) Close ¶
func (l *NullLogger) Close()
func (*NullLogger) Debugf ¶
func (l *NullLogger) Debugf(format string, a ...interface{})
func (*NullLogger) Errorf ¶
func (l *NullLogger) Errorf(format string, a ...interface{})
func (*NullLogger) GetLogLevel ¶
func (l *NullLogger) GetLogLevel() LogLevel
func (*NullLogger) Infof ¶
func (l *NullLogger) Infof(format string, a ...interface{})
func (*NullLogger) Printf ¶
func (l *NullLogger) Printf(level LogLevel, format string, a ...interface{})
func (*NullLogger) SetLogLevel ¶
func (l *NullLogger) SetLogLevel(level LogLevel)
type StdOutLogger ¶
type StdOutLogger struct {
// contains filtered or unexported fields
}
StdOutLogger - For mocking out in tests
func (*StdOutLogger) Close ¶
func (l *StdOutLogger) Close()
func (*StdOutLogger) Debugf ¶
func (l *StdOutLogger) Debugf(format string, a ...interface{})
func (*StdOutLogger) Errorf ¶
func (l *StdOutLogger) Errorf(format string, a ...interface{})
func (*StdOutLogger) GetLogLevel ¶
func (l *StdOutLogger) GetLogLevel() LogLevel
func (*StdOutLogger) Infof ¶
func (l *StdOutLogger) Infof(format string, a ...interface{})
func (*StdOutLogger) Printf ¶
func (l *StdOutLogger) Printf(level LogLevel, format string, a ...interface{})
func (*StdOutLogger) SetLogLevel ¶
func (l *StdOutLogger) SetLogLevel(level LogLevel)
type StdOutLoggerForTest ¶
type StdOutLoggerForTest struct {
// contains filtered or unexported fields
}
StdOutLoggerForTest - For mocking out in tests, but saves logs so they are searchable
func (*StdOutLoggerForTest) Close ¶
func (l *StdOutLoggerForTest) Close()
func (*StdOutLoggerForTest) Debugf ¶
func (l *StdOutLoggerForTest) Debugf(format string, a ...interface{})
func (*StdOutLoggerForTest) Errorf ¶
func (l *StdOutLoggerForTest) Errorf(format string, a ...interface{})
func (*StdOutLoggerForTest) GetLogLevel ¶
func (l *StdOutLoggerForTest) GetLogLevel() LogLevel
func (*StdOutLoggerForTest) Infof ¶
func (l *StdOutLoggerForTest) Infof(format string, a ...interface{})
func (*StdOutLoggerForTest) LastLogLine ¶
func (l *StdOutLoggerForTest) LastLogLine() string
Checking logs (for tests)
func (*StdOutLoggerForTest) LogContains ¶
func (l *StdOutLoggerForTest) LogContains(txt string) bool
func (*StdOutLoggerForTest) Printf ¶
func (l *StdOutLoggerForTest) Printf(level LogLevel, format string, a ...interface{})
func (*StdOutLoggerForTest) SetLogLevel ¶
func (l *StdOutLoggerForTest) SetLogLevel(level LogLevel)
Click to show internal directories.
Click to hide internal directories.