Documentation
¶
Overview ¶
Package logging provides a logging adapter that bridges to the original source code logging system
Index ¶
- func ContextWithLogger(ctx context.Context, logger Logger) context.Context
- func Critical(msg string, fields ...Field)
- func Criticalf(format string, args ...interface{})
- func Debug(msg string, fields ...Field)
- func Debugf(format string, args ...interface{})
- func Error(msg string, fields ...Field)
- func Errorf(format string, args ...interface{})
- func Fatal(msg string, fields ...Field)
- func Fatalf(format string, args ...interface{})
- func Info(msg string, fields ...Field)
- func Infof(format string, args ...interface{})
- func Panic(msg string, fields ...Field)
- func Panicf(format string, args ...interface{})
- func Warn(msg string, fields ...Field)
- func Warnf(format string, args ...interface{})
- type Field
- func Any(key string, value interface{}) Field
- func Bool(key string, value bool) Field
- func Duration(key string, value time.Duration) Field
- func ErrorField(err error) Field
- func Int(key string, value int) Field
- func Int32(key string, value int32) Field
- func Int64(key string, value int64) Field
- func String(key, value string) Field
- func Strings(key string, values []string) Field
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger returns a new context containing logger.
func Criticalf ¶
func Criticalf(format string, args ...interface{})
Criticalf logs at critical level with format
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs at debug level with format
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs at error level with format
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs at fatal level with format
Types ¶
type Field ¶
type Field struct {
Key string
Value interface{}
}
Field represents a structured logging field
type Logger ¶
type Logger interface {
Debug(msg string, fields ...Field)
Debugf(format string, args ...interface{})
Info(msg string, fields ...Field)
Infof(format string, args ...interface{})
Warn(msg string, fields ...Field)
Warnf(format string, args ...interface{})
Error(msg string, fields ...Field)
Errorf(format string, args ...interface{})
With(fields ...Field) Logger
}
Logger interface that mimics original logger behavior
func FromContext ¶
FromContext returns the logger from ctx, or a new logger if none exists.
Click to show internal directories.
Click to hide internal directories.