Documentation ¶
Overview ¶
package logger is a package that provides a structured logger that's context.Context aware.
Index ¶
- Variables
- func Debug(ctx context.Context, msg string, pairs ...interface{})
- func Error(ctx context.Context, msg string, pairs ...interface{})
- func FormatLevel(level Level) string
- func Info(ctx context.Context, msg string, pairs ...interface{})
- func Warn(ctx context.Context, msg string, pairs ...interface{})
- func WithLogger(ctx context.Context, l Logger) context.Context
- type Level
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLogLevel = INFO
View Source
var DefaultLogger = New(log.New(os.Stdout, "[default] ", log.LstdFlags), DefaultLogLevel)
Functions ¶
func FormatLevel ¶
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, pairs ...interface{}) Info(msg string, pairs ...interface{}) Warn(msg string, pairs ...interface{}) Error(msg string, pairs ...interface{}) With(pairs ...interface{}) Logger }
Logger represents a structured leveled logger.
func FromContext ¶
FromContext returns a log.Logger from the context.
Click to show internal directories.
Click to hide internal directories.