Documentation ¶
Index ¶
- Constants
- Variables
- func Value(ctx context.Context, v interface{}) interface{}
- type Filter
- type FilterOption
- type Helper
- func (h *Helper) Debug(a ...interface{})
- func (h *Helper) Debugf(format string, a ...interface{})
- func (h *Helper) Debugw(keyvals ...interface{})
- func (h *Helper) Error(a ...interface{})
- func (h *Helper) Errorf(format string, a ...interface{})
- func (h *Helper) Errorw(keyvals ...interface{})
- func (h *Helper) Fatal(a ...interface{})
- func (h *Helper) Fatalf(format string, a ...interface{})
- func (h *Helper) Fatalw(keyvals ...interface{})
- func (h *Helper) Info(a ...interface{})
- func (h *Helper) Infof(format string, a ...interface{})
- func (h *Helper) Infow(keyvals ...interface{})
- func (h *Helper) Log(level Level, keyvals ...interface{})
- func (h *Helper) Warn(a ...interface{})
- func (h *Helper) Warnf(format string, a ...interface{})
- func (h *Helper) Warnw(keyvals ...interface{})
- func (h *Helper) WithContext(ctx context.Context) *Helper
- type Level
- type Logger
- type Option
- type Valuer
Constants ¶
View Source
const LevelKey = "level"
LevelKey is logger level key.
Variables ¶
View Source
var ( // DefaultCaller is a Valuer that returns the file and line. DefaultCaller = Caller(defaultDepth) // DefaultTimestamp is a Valuer that returns the current wallclock time. DefaultTimestamp = Timestamp(time.RFC3339) )
View Source
var DefaultMessageKey = "msg"
Functions ¶
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a logger filter.
func NewFilter ¶
func NewFilter(logger Logger, opts ...FilterOption) *Filter
NewFilter new a logger filter.
type FilterOption ¶
type FilterOption func(*Filter)
FilterOption is filter option.
func FilterFunc ¶
func FilterFunc(f func(level Level, keyvals ...interface{}) bool) FilterOption
FilterFunc with filter func.
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper is a logger helper.
func (*Helper) Debug ¶
func (h *Helper) Debug(a ...interface{})
Debug logs a message at debug level.
func (*Helper) Debugw ¶
func (h *Helper) Debugw(keyvals ...interface{})
Debugw logs a message at debug level.
func (*Helper) Error ¶
func (h *Helper) Error(a ...interface{})
Error logs a message at error level.
func (*Helper) Errorw ¶
func (h *Helper) Errorw(keyvals ...interface{})
Errorw logs a message at error level.
func (*Helper) Fatal ¶
func (h *Helper) Fatal(a ...interface{})
Fatal logs a message at fatal level.
func (*Helper) Fatalw ¶
func (h *Helper) Fatalw(keyvals ...interface{})
Fatalw logs a message at fatal level.
func (*Helper) Infow ¶
func (h *Helper) Infow(keyvals ...interface{})
Infow logs a message at info level.
type Level ¶
type Level int8
Level is a logger level.
func ParseLevel ¶
ParseLevel parses a level string into a logger Level value.
type Logger ¶
Logger is a logger interface.
var DefaultLogger Logger = NewStdLogger(log.Writer())
DefaultLogger is default logger.
Click to show internal directories.
Click to hide internal directories.