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) Enabled(level Level) bool
- 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 日志级别 KEY。
Variables ¶
View Source
var ( // DefaultCaller 是一个返回文件和行号的 Valuer。 DefaultCaller = Caller(4) // DefaultTimestamp 是一个返回当前时间的 Valuer。 DefaultTimestamp = Timestamp(time.RFC3339) )
View Source
var DefaultLogger = NewStdLogger(log.Writer())
DefaultLogger 默认日志记录器。
View Source
var DefaultMessageKey = "msg"
DefaultMessageKey 默认消息KEY。
Functions ¶
Types ¶
type FilterOption ¶
type FilterOption func(*Filter)
FilterOption 过滤器选项。
func FilterFunc ¶
func FilterFunc(f func(level Level, keyvals ...any) bool) FilterOption
FilterFunc 配置过滤器方法。
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper 是一个日志助手。
type Option ¶
type Option func(*Helper)
Option 日志助手选项。
func WithSprint ¶ added in v1.2.13
WithSprint 配置 sprint。
type WriterOptionFn ¶ added in v1.2.5
type WriterOptionFn func(w *writerWrapper)
func WithWriteMessageKey ¶ added in v1.2.5
func WithWriteMessageKey(key string) WriterOptionFn
WithWriteMessageKey 配置 Writer 包装器助手消息 KEY。
func WithWriterLevel ¶ added in v1.2.5
func WithWriterLevel(level Level) WriterOptionFn
WithWriterLevel 配置 Writer 包装器等级。
Click to show internal directories.
Click to hide internal directories.