Documentation ¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(msgFormat string, args ...interface{})
- func Debugw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(msgFormat string, args ...interface{})
- func Errorw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(msgFormat string, args ...interface{})
- func Fatalw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func Info(args ...interface{})
- func Infof(msgFormat string, args ...interface{})
- func Infow(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func ReplaceGlobal(logger Logger)
- func Warn(args ...interface{})
- func Warnf(msgFormat string, args ...interface{})
- func Warnw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- type DefaultLogger
- func (l *DefaultLogger) Clone(options ...OptionFunc) Logger
- func (l *DefaultLogger) Debug(args ...interface{})
- func (l *DefaultLogger) Debugf(msgFormat string, args ...interface{})
- func (l *DefaultLogger) Debugw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func (l *DefaultLogger) Error(args ...interface{})
- func (l *DefaultLogger) Errorf(msgFormat string, args ...interface{})
- func (l *DefaultLogger) Errorw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func (l *DefaultLogger) Fatal(args ...interface{})
- func (l *DefaultLogger) Fatalf(msgFormat string, args ...interface{})
- func (l *DefaultLogger) Fatalw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func (l *DefaultLogger) Info(args ...interface{})
- func (l *DefaultLogger) Infof(msgFormat string, args ...interface{})
- func (l *DefaultLogger) Infow(keysAndValues []interface{}, msgFormat string, args ...interface{})
- func (l *DefaultLogger) Warn(args ...interface{})
- func (l *DefaultLogger) Warnf(msgFormat string, args ...interface{})
- func (l *DefaultLogger) Warnw(keysAndValues []interface{}, msgFormat string, args ...interface{})
- type Logger
- type OptionFunc
- type Options
- type Properties
- type TestingLogger
- type TestingWriter
Constants ¶
const ( OutputModeJson = "json" OutputModeConsole = "console" )
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(msgFormat string, args ...interface{})
Debugf uses fmt.Sprintf to log a template message.
func Debugw ¶
func Debugw(keysAndValues []interface{}, msgFormat string, args ...interface{})
Debugw uses fmt.Sprintf to log a template message with extra context value.
func Errorf ¶
func Errorf(msgFormat string, args ...interface{})
Errorf uses fmt.Sprintf to log a template message.
func Errorw ¶
func Errorw(keysAndValues []interface{}, msgFormat string, args ...interface{})
Errorw uses fmt.Sprintf to log a template message with extra context value.
func Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func Fatalf ¶
func Fatalf(msgFormat string, args ...interface{})
Fatalf uses fmt.Sprintf to log a template message, then calls os.Exit.
func Fatalw ¶
func Fatalw(keysAndValues []interface{}, msgFormat string, args ...interface{})
Fatalw uses fmt.Sprintf to log a template message with extra context value, then calls os.Exit.
func Infof ¶
func Infof(msgFormat string, args ...interface{})
Infof uses fmt.Sprintf to log a template message.
func Infow ¶
func Infow(keysAndValues []interface{}, msgFormat string, args ...interface{})
Infow uses fmt.Sprintf to log a template message with extra context value.
func ReplaceGlobal ¶
func ReplaceGlobal(logger Logger)
ReplaceGlobal Register a logger instance as global
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
func NewDefaultLogger ¶
func NewDefaultLogger(options *Options) (*DefaultLogger, error)
func (*DefaultLogger) Clone ¶
func (l *DefaultLogger) Clone(options ...OptionFunc) Logger
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(args ...interface{})
func (*DefaultLogger) Debugf ¶
func (l *DefaultLogger) Debugf(msgFormat string, args ...interface{})
func (*DefaultLogger) Debugw ¶
func (l *DefaultLogger) Debugw(keysAndValues []interface{}, msgFormat string, args ...interface{})
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(args ...interface{})
func (*DefaultLogger) Errorf ¶
func (l *DefaultLogger) Errorf(msgFormat string, args ...interface{})
func (*DefaultLogger) Errorw ¶
func (l *DefaultLogger) Errorw(keysAndValues []interface{}, msgFormat string, args ...interface{})
func (*DefaultLogger) Fatal ¶
func (l *DefaultLogger) Fatal(args ...interface{})
func (*DefaultLogger) Fatalf ¶
func (l *DefaultLogger) Fatalf(msgFormat string, args ...interface{})
func (*DefaultLogger) Fatalw ¶
func (l *DefaultLogger) Fatalw(keysAndValues []interface{}, msgFormat string, args ...interface{})
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(args ...interface{})
func (*DefaultLogger) Infof ¶
func (l *DefaultLogger) Infof(msgFormat string, args ...interface{})
func (*DefaultLogger) Infow ¶
func (l *DefaultLogger) Infow(keysAndValues []interface{}, msgFormat string, args ...interface{})
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(args ...interface{})
func (*DefaultLogger) Warnf ¶
func (l *DefaultLogger) Warnf(msgFormat string, args ...interface{})
func (*DefaultLogger) Warnw ¶
func (l *DefaultLogger) Warnw(keysAndValues []interface{}, msgFormat string, args ...interface{})
type Logger ¶
type Logger interface { // Info uses fmt.Sprint to construct and log a message. Info(args ...interface{}) // Infof uses fmt.Sprintf to log a template message. Infof(msgFormat string, args ...interface{}) // Infow uses fmt.Sprintf to log a template message with extra context value. Infow(keysAndValues []interface{}, msgFormat string, args ...interface{}) // Debug uses fmt.Sprint to construct and log a message. Debug(args ...interface{}) // Debugf uses fmt.Sprintf to log a template message. Debugf(msgFormat string, args ...interface{}) // Debugw uses fmt.Sprintf to log a template message with extra context value. Debugw(keysAndValues []interface{}, msgFormat string, args ...interface{}) // Warn uses fmt.Sprint to construct and log a message. Warn(args ...interface{}) // Warnf uses fmt.Sprintf to log a template message. Warnf(msgFormat string, args ...interface{}) // Warnw uses fmt.Sprintf to log a template message with extra context value. Warnw(keysAndValues []interface{}, msgFormat string, args ...interface{}) // Error uses fmt.Sprint to construct and log a message. Error(args ...interface{}) // Errorf uses fmt.Sprintf to log a template message. Errorf(msgFormat string, args ...interface{}) // Errorw uses fmt.Sprintf to log a template message with extra context value. Errorw(keysAndValues []interface{}, msgFormat string, args ...interface{}) // Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit. Fatal(args ...interface{}) // Fatalf uses fmt.Sprintf to log a template message, then calls os.Exit. Fatalf(msgFormat string, args ...interface{}) // Fatalw uses fmt.Sprintf to log a template message with extra context value, then calls os.Exit. Fatalw(keysAndValues []interface{}, msgFormat string, args ...interface{}) }
type OptionFunc ¶
type OptionFunc func(opt *Options)
func AddCallerSkip ¶
func AddCallerSkip(skip int) OptionFunc
type Properties ¶
type Properties struct { Development bool `default:"false"` JsonOutputMode bool `default:"true"` CallerSkip int `default:"2"` }
func NewProperties ¶
func NewProperties(loader config.Loader) (*Properties, error)
func (Properties) Prefix ¶
func (l Properties) Prefix() string
type TestingLogger ¶
type TestingLogger struct { *DefaultLogger // contains filtered or unexported fields }
func NewTestingLogger ¶
func NewTestingLogger(tb testing.TB, options *Options) (*TestingLogger, error)
func NewTestingLoggerFromDefault ¶
func NewTestingLoggerFromDefault(tb testing.TB, defaultLogger *DefaultLogger) *TestingLogger
type TestingWriter ¶
type TestingWriter struct {
// contains filtered or unexported fields
}
TestingWriter is a WriteSyncer that writes to the given testing.TB.
func NewTestingWriter ¶
func NewTestingWriter(tb testing.TB) TestingWriter
func (TestingWriter) Sync ¶
func (w TestingWriter) Sync() error