Documentation ¶
Overview ¶
Package modlog provides a moduled wrapper for any underlying log.Logger implementation.
Index ¶
- func SwitchLogOutputToBuffer(logger log.Logger)
- func VerifyCustomLogger(t *testing.T, logger log.Logger, module string)
- func VerifyDefaultLogging(t *testing.T, logger log.Logger, module string, ...)
- type DefLog
- func (l *DefLog) Debugf(format string, args ...interface{})
- func (l *DefLog) Errorf(format string, args ...interface{})
- func (l *DefLog) Fatalf(format string, args ...interface{})
- func (l *DefLog) Infof(format string, args ...interface{})
- func (l *DefLog) Panicf(format string, args ...interface{})
- func (l *DefLog) SetOutput(output io.Writer)
- func (l *DefLog) Warnf(format string, args ...interface{})
- type ModLog
- func (m *ModLog) Debugf(format string, args ...interface{})
- func (m *ModLog) Errorf(format string, args ...interface{})
- func (m *ModLog) Fatalf(format string, args ...interface{})
- func (m *ModLog) Infof(format string, args ...interface{})
- func (m *ModLog) Panicf(format string, args ...interface{})
- func (m *ModLog) Warnf(format string, args ...interface{})
- type SampleLog
- func (m *SampleLog) Debugf(format string, args ...interface{})
- func (m *SampleLog) Errorf(format string, args ...interface{})
- func (m *SampleLog) Fatalf(format string, args ...interface{})
- func (m *SampleLog) Infof(format string, args ...interface{})
- func (m *SampleLog) Panicf(format string, args ...interface{})
- func (m *SampleLog) Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SwitchLogOutputToBuffer ¶
SwitchLogOutputToBuffer switches log output to test buffer. Should only be used for testing.
func VerifyCustomLogger ¶
VerifyCustomLogger verifies custom logging behaviour. Should only be used for tests.
Types ¶
type DefLog ¶
type DefLog struct {
// contains filtered or unexported fields
}
DefLog is a logger implementation built on top of standard go log. There is a configurable caller info feature which displays caller function information name in logged lines. caller info can be configured by log levels and modules. By default it is enabled. Log Format : [<MODULE NAME>] <TIME IN UTC> - <CALLER INFO> -> <LOG LEVEL> <LOG TEXT>.
func (*DefLog) Debugf ¶
Debugf calls go 'log.Output' and can be used for logging verbose messages. Arguments are handled in the manner of fmt.Printf.
func (*DefLog) Errorf ¶
Errorf calls go 'log.Output' and can be used for logging errors. Arguments are handled in the manner of fmt.Printf.
func (*DefLog) Infof ¶
Infof calls go 'log.Output' and can be used for logging general information messages. INFO is default logging level Arguments are handled in the manner of fmt.Printf.
type ModLog ¶
type ModLog struct {
// contains filtered or unexported fields
}
ModLog is a moduled wrapper for any underlying 'log.Logger' implementation. Since this is a moduled wrapper each module can have different logging levels (default is INFO).
func NewModLog ¶
NewModLog returns new moduled logger instance based on given logger implementation and module.
type SampleLog ¶
type SampleLog struct {
// contains filtered or unexported fields
}
SampleLog is a sample logger implementation for testing purposes. note: this implementation should be strictly used for testing only.
func GetSampleCustomLogger ¶
GetSampleCustomLogger returns custom logger which can only be used for testing purposes.