Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(a ...any)
- func Debugf(format string, a ...any)
- func Debugw(keyvals ...any)
- func Error(a ...any)
- func Errorf(format string, a ...any)
- func Errorw(keyvals ...any)
- func Fatal(a ...any)
- func Fatalf(format string, a ...any)
- func Fatalw(keyvals ...any)
- func Info(a ...any)
- func Infof(format string, a ...any)
- func Infow(keyvals ...any)
- func Log(level Level, keyvals ...any)
- func NewWriter(logger Logger, opts ...WriterOptionFn) io.Writer
- func SetLogger(logger Logger)
- func Value(ctx context.Context, v any) any
- func Warn(a ...any)
- func Warnf(format string, a ...any)
- func Warnw(keyvals ...any)
- type Filter
- type FilterOption
- type Helper
- func (h *Helper) Debug(a ...any)
- func (h *Helper) Debugf(format string, a ...any)
- func (h *Helper) Debugw(keyvals ...any)
- func (h *Helper) Error(a ...any)
- func (h *Helper) Errorf(format string, a ...any)
- func (h *Helper) Errorw(keyvals ...any)
- func (h *Helper) Fatal(a ...any)
- func (h *Helper) Fatalf(format string, a ...any)
- func (h *Helper) Fatalw(keyvals ...any)
- func (h *Helper) Info(a ...any)
- func (h *Helper) Infof(format string, a ...any)
- func (h *Helper) Infow(keyvals ...any)
- func (h *Helper) Log(level Level, keyvals ...any)
- func (h *Helper) Warn(a ...any)
- func (h *Helper) Warnf(format string, a ...any)
- func (h *Helper) Warnw(keyvals ...any)
- func (h *Helper) WithContext(ctx context.Context) *Helper
- type Level
- type Logger
- type Option
- type Valuer
- type WriterOptionFn
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(4) // DefaultTimestamp is a Valuer that returns the current wallclock time. DefaultTimestamp = Timestamp(time.RFC3339) )
View Source
var DefaultLogger = NewStdLogger(log.Writer())
DefaultLogger is default logger.
View Source
var DefaultMessageKey = "msg"
DefaultMessageKey default message key.
Functions ¶
func NewWriter ¶
func NewWriter(logger Logger, opts ...WriterOptionFn) io.Writer
NewWriter return a writer wrapper.
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 ...any) bool) FilterOption
FilterFunc with filter func.
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper is a logger helper.
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.
type Valuer ¶
Valuer is returns a log value.
type WriterOptionFn ¶
type WriterOptionFn func(w *writerWrapper)
func WithWriteMessageKey ¶
func WithWriteMessageKey(key string) WriterOptionFn
WithWriteMessageKey set writerWrapper helper message key.
func WithWriterLevel ¶
func WithWriterLevel(level Level) WriterOptionFn
WithWriterLevel set writerWrapper level.
Click to show internal directories.
Click to hide internal directories.