Documentation
¶
Index ¶
- type Logger
- type StandardLogger
- func (l *StandardLogger) Debug(fmt string, a ...interface{})
- func (l *StandardLogger) Error(fmt string, a ...interface{})
- func (l *StandardLogger) Fatal(fmt string, a ...interface{})
- func (l *StandardLogger) GetLevel() string
- func (l *StandardLogger) Info(fmt string, a ...interface{})
- func (l *StandardLogger) Panic(fmt string, a ...interface{})
- func (l *StandardLogger) SetCallerReporter()
- func (l *StandardLogger) SetLevel(level string)
- func (l *StandardLogger) SetOutput(w io.Writer)
- func (l *StandardLogger) SetOutputFormat(format string)
- func (l *StandardLogger) Trace(fmt string, a ...interface{})
- func (l *StandardLogger) Warn(fmt string, a ...interface{})
- func (l *StandardLogger) WithError(err error) Logger
- func (l *StandardLogger) WithField(name string, value interface{}) Logger
- func (l *StandardLogger) WithFields(fields map[string]interface{}) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { Panic(fmt string, a ...interface{}) Fatal(fmt string, a ...interface{}) Error(fmt string, a ...interface{}) Warn(fmt string, a ...interface{}) Info(fmt string, a ...interface{}) Debug(fmt string, a ...interface{}) Trace(fmt string, a ...interface{}) WithFields(map[string]interface{}) Logger WithField(string, interface{}) Logger WithError(err error) Logger GetLevel() string SetLevel(string) SetOutputFormat(format string) SetCallerReporter() }
type StandardLogger ¶
type StandardLogger struct {
// contains filtered or unexported fields
}
func (*StandardLogger) Debug ¶
func (l *StandardLogger) Debug(fmt string, a ...interface{})
func (*StandardLogger) Error ¶
func (l *StandardLogger) Error(fmt string, a ...interface{})
func (*StandardLogger) Fatal ¶
func (l *StandardLogger) Fatal(fmt string, a ...interface{})
func (*StandardLogger) GetLevel ¶
func (l *StandardLogger) GetLevel() string
GetLevel return the current logging level.
func (*StandardLogger) Info ¶
func (l *StandardLogger) Info(fmt string, a ...interface{})
func (*StandardLogger) Panic ¶
func (l *StandardLogger) Panic(fmt string, a ...interface{})
func (*StandardLogger) SetCallerReporter ¶
func (l *StandardLogger) SetCallerReporter()
SetCallerReporter add calling method as a field.
func (*StandardLogger) SetLevel ¶
func (l *StandardLogger) SetLevel(level string)
SetLevel sets the logger level.
func (*StandardLogger) SetOutput ¶
func (l *StandardLogger) SetOutput(w io.Writer)
SetOutput sets the underlying logrus output.
func (*StandardLogger) SetOutputFormat ¶
func (l *StandardLogger) SetOutputFormat(format string)
SetOutputFormat change the logger format. available formats: text/json
func (*StandardLogger) Trace ¶
func (l *StandardLogger) Trace(fmt string, a ...interface{})
func (*StandardLogger) Warn ¶
func (l *StandardLogger) Warn(fmt string, a ...interface{})
func (*StandardLogger) WithError ¶
func (l *StandardLogger) WithError(err error) Logger
WithError add an error as single field to the logger.
func (*StandardLogger) WithField ¶
func (l *StandardLogger) WithField(name string, value interface{}) Logger
WithField create new logger instance with singe field.
func (*StandardLogger) WithFields ¶
func (l *StandardLogger) WithFields(fields map[string]interface{}) Logger
WithFields create new logger instance with the given default fields.
Example: logger :=log.WithFields(map[string]interface{}{"test": 2222}) logger.Info("Cellar message") -> `INFO[0000] Cellar message test=2222`
Click to show internal directories.
Click to hide internal directories.