Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, message string)
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Error(ctx context.Context, err error, message string)
- func Errorf(ctx context.Context, err error, format string, args ...interface{})
- func GetLogrusLogEntryFromContext(ctx context.Context) *logrus.Entrydeprecated
- func GetLogrusLoggerFromContext(ctx context.Context) *logrus.Loggerdeprecated
- func Info(ctx context.Context, message string)
- func Infof(ctx context.Context, format string, args ...interface{})
- func LogrusLoggerToContext(ctx context.Context, logger *logrus.Logger, entry *logrus.Entry) context.Contextdeprecated
- func PutLogger(ctx context.Context, logger Logger) context.Context
- func WithDuration(ctx context.Context, key string, value time.Duration) context.Context
- func WithInt(ctx context.Context, key string, value int) context.Context
- func WithLevel(ctx context.Context, level Level) context.Context
- func WithStr(ctx context.Context, key string, value string) context.Context
- type Level
- type Logger
Constants ¶
View Source
const ( ErrorLevel = Level(logrus.ErrorLevel) // 2 InfoLevel = Level(logrus.InfoLevel) // 4 DebugLevel = Level(logrus.DebugLevel) // 5 )
Variables ¶
This section is empty.
Functions ¶
func GetLogrusLogEntryFromContext
deprecated
func GetLogrusLoggerFromContext
deprecated
func WithDuration ¶
WithDuration returns the given context with a logger that persists the given key/value.
Types ¶
type Level ¶
type Level int
Level represents the level at which a logger will log. The currently supported values are: 2 - Error 4 - Info 5 - Debug.
type Logger ¶
type Logger interface { Error(err error, message string) Info(message string) Debug(message string) // WithStr returns a new logger that persists the given key/value. WithStr(key string, value string) Logger // WithInt returns a new logger that persists the given key/value. WithInt(key string, value int) Logger // WithDuration returns a new logger that persists the given key/value. WithDuration(key string, value time.Duration) Logger // WithLevel returns a new logger that logs the given level or below. WithLevel(level Level) Logger // Inject puts the logger into the context, returning the new context and a function that // can be later used to restore the logger from the context. Inject(ctx context.Context) (context.Context, func(ctx context.Context) Logger) }
Logger is a component used to perform logging.
func NewDefaultLogger ¶
func NewDefaultLogger() Logger
NewDefaultLogger returns a logger that is regarded as the default logger to use within an application when no logger configuration is provided.
func NewLogrusLogger ¶
NewLogrusLogger returns an implementation of Logger that uses the Logrus logger.
func NewPkgLogger ¶
NewPkgLogger returns is an implementation of Logger that uses the pkg/log logger.
func NewZeroPkgLogger ¶
NewZeroPkgLogger returns is an implementation of Logger that uses the pkg/logging logger.
Click to show internal directories.
Click to hide internal directories.