Documentation
¶
Overview ¶
Package xlog provides utilities for logging with context arguments. This package allows you to attach key-value pairs to a context, which can be used by the logging system to print additional information.
Index ¶
- func ContextWithArgs(ctx context.Context, kvs ...any) context.Context
- func Debug(ctx context.Context, format string, args ...any)
- func Error(ctx context.Context, format string, args ...any)
- func Info(ctx context.Context, format string, args ...any)
- func InitDefault(opt Option)
- func Warn(ctx context.Context, format string, args ...any)
- type Logger
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithArgs ¶
ContextWithArgs returns a context with key-values which myslog will print.
func InitDefault ¶
func InitDefault(opt Option)
Types ¶
type Option ¶ added in v0.0.9
type Option struct { Level string `default:"info"` Writer io.Writer Stdout bool `default:"false"` // 仅当 Writer 为空时生效 Path string `default:"./log/default.log"` // 仅当 Writer 为空时生效 MaxSizeMB int `default:"64"` // 仅当 Writer 为空时生效 MaxBackups int `default:"100"` // 仅当 Writer 为空时生效 MaxDays int `default:"90"` // 仅当 Writer 为空时生效 }
Click to show internal directories.
Click to hide internal directories.