Documentation
¶
Index ¶
- func ContextWithLogger(ctx context.Context, logger Logger) context.Context
- func Debug(ctx context.Context, values ...interface{})
- func Debugf(ctx context.Context, pattern string, args ...interface{})
- func Debugln(ctx context.Context, values ...interface{})
- func Error(ctx context.Context, values ...interface{})
- func Errorf(ctx context.Context, pattern string, args ...interface{})
- func Errorln(ctx context.Context, values ...interface{})
- func Fatal(ctx context.Context, values ...interface{})
- func Fatalf(ctx context.Context, pattern string, args ...interface{})
- func Fatalln(ctx context.Context, values ...interface{})
- func Info(ctx context.Context, values ...interface{})
- func Infof(ctx context.Context, pattern string, args ...interface{})
- func Infoln(ctx context.Context, values ...interface{})
- func Panic(ctx context.Context, values ...interface{})
- func Panicf(ctx context.Context, pattern string, args ...interface{})
- func Panicln(ctx context.Context, values ...interface{})
- func SetDefault(logger Logger) error
- func Trace(ctx context.Context, values ...interface{})
- func Tracef(ctx context.Context, pattern string, args ...interface{})
- func Traceln(ctx context.Context, values ...interface{})
- func Warn(ctx context.Context, values ...interface{})
- func Warnf(ctx context.Context, pattern string, args ...interface{})
- func Warnln(ctx context.Context, values ...interface{})
- type Fields
- type Level
- type Logger
- type LogrusWrapper
- func (l LogrusWrapper) Debug(args ...interface{})
- func (l LogrusWrapper) Debugf(format string, args ...interface{})
- func (l LogrusWrapper) Debugln(args ...interface{})
- func (l LogrusWrapper) Error(args ...interface{})
- func (l LogrusWrapper) Errorf(format string, args ...interface{})
- func (l LogrusWrapper) Errorln(args ...interface{})
- func (l LogrusWrapper) Fatal(args ...interface{})
- func (l LogrusWrapper) Fatalf(format string, args ...interface{})
- func (l LogrusWrapper) Fatalln(args ...interface{})
- func (l LogrusWrapper) Info(args ...interface{})
- func (l LogrusWrapper) Infof(format string, args ...interface{})
- func (l LogrusWrapper) Infoln(args ...interface{})
- func (l LogrusWrapper) Panic(args ...interface{})
- func (l LogrusWrapper) Panicf(format string, args ...interface{})
- func (l LogrusWrapper) Panicln(args ...interface{})
- func (l LogrusWrapper) SetFormatter(formatter logrus.Formatter)
- func (l LogrusWrapper) SetLevel(level Level)
- func (l LogrusWrapper) Trace(args ...interface{})
- func (l LogrusWrapper) Tracef(format string, args ...interface{})
- func (l LogrusWrapper) Traceln(args ...interface{})
- func (l LogrusWrapper) Warn(args ...interface{})
- func (l LogrusWrapper) Warnf(format string, args ...interface{})
- func (l LogrusWrapper) Warnln(args ...interface{})
- func (l LogrusWrapper) WithField(key string, value interface{}) Logger
- func (l LogrusWrapper) WithFields(fields Fields) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger creates a new context with the given logger.
func SetDefault ¶
SetDefault sets the default logger. Using this package should be avoided as much as possible.
Types ¶
type Fields ¶
type Fields map[string]interface{}
Fields is a map of keys to values that captures the fields a logger is carrying.
type Level ¶
type Level uint8
Level is the severity level of a log statement.
const ( // LevelPanic level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... LevelPanic Level = iota // LevelFatal level. Logs and then calls `logger.Exit(1)`. It will exit even if the // logging level is set to Panic. LevelFatal // LevelError level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. LevelError // LevelWarn level. Non-critical entries that deserve eyes. LevelWarn // LevelInfo level. General operational entries about what's going on inside the // application. LevelInfo // LevelDebug level. Usually only enabled when debugging. Very verbose logging. LevelDebug // LevelTrace level. Designates finer-grained informational events than the Debug. LevelTrace )
func ParseLevel ¶
ParseLevel takes a string level and returns the Logrus log level constant.
type Logger ¶
type Logger interface { // Trace logs a message at level Trace on the standard logger. Trace(...interface{}) // Traceln logs a message at level Trace on the standard logger. Traceln(...interface{}) // Tracef logs a message at level Trace on the standard logger. Tracef(string, ...interface{}) // Debug logs a message at level Debug on the standard logger. Debug(...interface{}) // Debugln logs a message at level Debug on the standard logger. Debugln(...interface{}) // Debugf logs a message at level Debug on the standard logger. Debugf(string, ...interface{}) // Info logs a message at level Info on the standard logger. Info(...interface{}) // Infoln logs a message at level Info on the standard logger. Infoln(...interface{}) // Infof logs a message at level Info on the standard logger. Infof(string, ...interface{}) // Warn logs a message at level Warn on the standard logger. Warn(...interface{}) // Warnln logs a message at level Warn on the standard logger. Warnln(...interface{}) // Warnf logs a message at level Warn on the standard logger. Warnf(string, ...interface{}) // Error logs a message at level Error on the standard logger. Error(...interface{}) // Errorln logs a message at level Error on the standard logger. Errorln(...interface{}) // Errorf logs a message at level Error on the standard logger. Errorf(string, ...interface{}) // Fatal logs a message at level Fatal on the standard logger and exit immediately. Fatal(...interface{}) // Fatalln logs a message at level Fatal on the standard logger and exit immediately. Fatalln(...interface{}) // Fatalf logs a message at level Fatal on the standard logger and exit immediately. Fatalf(string, ...interface{}) // Panic logs a message at level Panic on the standard logger. Panic(...interface{}) // Panicln logs a message at level Panic on the standard logger. Panicln(...interface{}) // Panicf logs a message at level Panic on the standard logger. Panicf(string, ...interface{}) // SetLevel sets the log level. SetLevel(Level) // WithField creates a new logger with the given key and value pair added, existing values get overwritten. WithField(key string, value interface{}) Logger // WithFields creates a new logger with with the given table of keys and values, existing values get overwritten. WithFields(Fields) Logger }
Logger describes ability to log application events.
func LoggerFromContext ¶
LoggerFromContext returns active logger for the given ctx or the default logger if none is specified in the context.
type LogrusWrapper ¶
type LogrusWrapper struct {
// contains filtered or unexported fields
}
func NewLogrusWrapper ¶
func NewLogrusWrapper(logger *logrus.Logger) LogrusWrapper
func (LogrusWrapper) Debug ¶
func (l LogrusWrapper) Debug(args ...interface{})
Debug logs a message at level Debug on the standard logger.
func (LogrusWrapper) Debugf ¶
func (l LogrusWrapper) Debugf(format string, args ...interface{})
Debugf logs a message at level Debugf on the standard logger.
func (LogrusWrapper) Debugln ¶
func (l LogrusWrapper) Debugln(args ...interface{})
Debugln logs a message at level Debugln on the standard logger.
func (LogrusWrapper) Error ¶
func (l LogrusWrapper) Error(args ...interface{})
Error logs a message at level Error on the standard logger.
func (LogrusWrapper) Errorf ¶
func (l LogrusWrapper) Errorf(format string, args ...interface{})
Errorf logs a message at level Errorf on the standard logger.
func (LogrusWrapper) Errorln ¶
func (l LogrusWrapper) Errorln(args ...interface{})
Errorln logs a message at level Errorln on the standard logger.
func (LogrusWrapper) Fatal ¶
func (l LogrusWrapper) Fatal(args ...interface{})
Fatal logs a message at level Fatal on the standard logger.
func (LogrusWrapper) Fatalf ¶
func (l LogrusWrapper) Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatalf on the standard logger.
func (LogrusWrapper) Fatalln ¶
func (l LogrusWrapper) Fatalln(args ...interface{})
Fatalln logs a message at level Fatalln on the standard logger.
func (LogrusWrapper) Info ¶
func (l LogrusWrapper) Info(args ...interface{})
Info logs a message at level Info on the standard logger.
func (LogrusWrapper) Infof ¶
func (l LogrusWrapper) Infof(format string, args ...interface{})
Infof logs a message at level Infof on the standard logger.
func (LogrusWrapper) Infoln ¶
func (l LogrusWrapper) Infoln(args ...interface{})
Infoln logs a message at level Infoln on the standard logger.
func (LogrusWrapper) Panic ¶
func (l LogrusWrapper) Panic(args ...interface{})
Panic logs a message at level Panic on the standard logger.
func (LogrusWrapper) Panicf ¶
func (l LogrusWrapper) Panicf(format string, args ...interface{})
Panicf logs a message at level Panic on the standard logger.
func (LogrusWrapper) Panicln ¶
func (l LogrusWrapper) Panicln(args ...interface{})
Panicln logs a message at level Panic on the standard logger.
func (LogrusWrapper) SetFormatter ¶
func (l LogrusWrapper) SetFormatter(formatter logrus.Formatter)
SetFormatter sets a custom logrus formatter.
func (LogrusWrapper) SetLevel ¶
func (l LogrusWrapper) SetLevel(level Level)
SetLevel sets the logger level.
func (LogrusWrapper) Trace ¶
func (l LogrusWrapper) Trace(args ...interface{})
Trace logs a message at level Trace on the standard logger.
func (LogrusWrapper) Tracef ¶
func (l LogrusWrapper) Tracef(format string, args ...interface{})
Tracef logs a message at level Tracef on the standard logger.
func (LogrusWrapper) Traceln ¶
func (l LogrusWrapper) Traceln(args ...interface{})
Traceln logs a message at level Traceln on the standard logger.
func (LogrusWrapper) Warn ¶
func (l LogrusWrapper) Warn(args ...interface{})
Warn logs a message at level Warn on the standard logger.
func (LogrusWrapper) Warnf ¶
func (l LogrusWrapper) Warnf(format string, args ...interface{})
Warnf logs a message at level Warnf on the standard logger.
func (LogrusWrapper) Warnln ¶
func (l LogrusWrapper) Warnln(args ...interface{})
Warnln logs a message at level Warnln on the standard logger.
func (LogrusWrapper) WithField ¶
func (l LogrusWrapper) WithField(key string, value interface{}) Logger
WithField adds field to the logger.
func (LogrusWrapper) WithFields ¶
func (l LogrusWrapper) WithFields(fields Fields) Logger
WithFields adds fields to the logger.