Documentation ¶
Index ¶
- func Debug(msg string, args ...any)
- func Error(msg string, args ...any)
- func Info(msg string, args ...any)
- func Log(level Level, msg string, args ...any)
- func NewMultiHandler(handlers ...slog.Handler) slog.Handler
- func ResetLogger()
- func SetLogger(l *Logger)
- func Warn(msg string, args ...any)
- type AttrType
- type Attribute
- type Color
- type Field
- func Any(key string, val any) Field
- func Bool(key string, val bool) Field
- func BoolP(key string, val *bool) Field
- func Duration(key string, val time.Duration) Field
- func DurationP(key string, val *time.Duration) Field
- func Err(err error) Field
- func Float[F generic.Float](key string, val F) Field
- func Float32[F generic.Float](key string, val F) Field
- func Float32P[F generic.Float](key string, val *F) Field
- func Float64[F generic.Float](key string, val F) Field
- func Float64P[F generic.Float](key string, val *F) Field
- func FloatP[F generic.Float](key string, val *F) Field
- func Group(key string, args ...any) Field
- func Int[I generic.Integer](key string, val I) Field
- func Int16[I generic.Integer](key string, val I) Field
- func Int16P[I generic.Integer](key string, val *I) Field
- func Int32[I generic.Integer](key string, val I) Field
- func Int32P[I generic.Integer](key string, val *I) Field
- func Int64[I generic.Integer](key string, val I) Field
- func Int64P[I generic.Integer](key string, val *I) Field
- func Int8[I generic.Integer](key string, val I) Field
- func Int8P[I generic.Integer](key string, val *I) Field
- func IntP[I generic.Integer](key string, val *I) Field
- func Skip(vs ...any) Field
- func Stack(key string) Field
- func String(key, val string) Field
- func StringP(key string, val *string) Field
- func Time(key string, val time.Time) Field
- func TimeP(key string, val *time.Time) Field
- func Uint[I generic.Integer](key string, val I) Field
- func Uint16[I generic.Integer](key string, val I) Field
- func Uint16P[I generic.Integer](key string, val *I) Field
- func Uint32[I generic.Integer](key string, val I) Field
- func Uint32P[I generic.Integer](key string, val *I) Field
- func Uint64[I generic.Integer](key string, val I) Field
- func Uint64P[I generic.Integer](key string, val *I) Field
- func Uint8[I generic.Integer](key string, val I) Field
- func Uint8P[I generic.Integer](key string, val *I) Field
- func UintP[I generic.Integer](key string, val *I) Field
- type Handler
- type Level
- type Logger
- type MinotaurHandler
- func (h *MinotaurHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *MinotaurHandler) GetOptions() *Options
- func (h *MinotaurHandler) Handle(ctx context.Context, record slog.Record) (err error)
- func (h *MinotaurHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *MinotaurHandler) WithGroup(name string) slog.Handler
- type MultiHandler
- type Options
- func (opt *Options) Apply(opts ...*Options) *Options
- func (opt *Options) GetAttrDelimiter(attrType AttrType) string
- func (opt *Options) GetAttrDelimiterColor(attrType AttrType) *Color
- func (opt *Options) GetAttrPrefix(attrType AttrType) string
- func (opt *Options) GetAttrPrefixColor(attrType AttrType) *Color
- func (opt *Options) GetAttrTextColor(attrType AttrType) *Color
- func (opt *Options) GetCallerFormatter() func(file string, line int) (repFile, repLine string)
- func (opt *Options) GetCallerSkip() int
- func (opt *Options) GetLevel() Level
- func (opt *Options) GetLevelColor(level Level) *Color
- func (opt *Options) GetLevelText(level Level) string
- func (opt *Options) GetStackTrace(level Level) bool
- func (opt *Options) GetStackTraceBeauty(level Level) bool
- func (opt *Options) GetTimeLayout() string
- func (opt *Options) IsDisabledCaller() bool
- func (opt *Options) IsDisabledColor() bool
- func (opt *Options) WithAttrDelimiter(attrType AttrType, delimiter string) *Options
- func (opt *Options) WithAttrDelimiterColor(attrType AttrType, color *Color) *Options
- func (opt *Options) WithAttrPrefix(attrType AttrType, prefix string) *Options
- func (opt *Options) WithAttrPrefixColor(attrType AttrType, color *Color) *Options
- func (opt *Options) WithAttrTextColor(attrType AttrType, color *Color) *Options
- func (opt *Options) WithCallerFormatter(formatter func(file string, line int) (repFile, repLine string)) *Options
- func (opt *Options) WithCallerSkip(skip int) *Options
- func (opt *Options) WithDisableCaller(disable bool) *Options
- func (opt *Options) WithDisableColor(disable bool) *Options
- func (opt *Options) WithLevel(level Level) *Options
- func (opt *Options) WithLevelColor(level Level, color *Color) *Options
- func (opt *Options) WithLevelText(level Level, text string) *Options
- func (opt *Options) WithStackTrace(level Level, enable bool) *Options
- func (opt *Options) WithStackTraceBeauty(level Level, enable bool) *Options
- func (opt *Options) WithTimeLayout(layout string) *Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMultiHandler ¶
NewMultiHandler 创建一个新的多处理程序
Types ¶
type Attribute ¶
const ( ColorReset Attribute = iota ColorBold ColorFaint ColorItalic ColorUnderline ColorBlinkSlow ColorBlinkRapid ColorReverseVideo ColorConcealed ColorCrossedOut )
Base attributes
const ( ColorFgBlack Attribute = iota + 30 ColorFgRed ColorFgGreen ColorFgYellow ColorFgBlue ColorFgMagenta ColorFgCyan ColorFgWhite )
Foreground text colors
const ( ColorFgHiBlack Attribute = iota + 90 ColorFgHiRed ColorFgHiGreen ColorFgHiYellow ColorFgHiBlue ColorFgHiMagenta ColorFgHiCyan ColorFgHiWhite )
Foreground Hi-Intensity text colors
type Field ¶
type MinotaurHandler ¶
type MinotaurHandler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(w io.Writer, opts ...*Options) *MinotaurHandler
func (*MinotaurHandler) GetOptions ¶
func (h *MinotaurHandler) GetOptions() *Options
type MultiHandler ¶
type MultiHandler struct {
// contains filtered or unexported fields
}
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options
func (*Options) GetAttrDelimiter ¶
GetAttrDelimiter 获取属性分隔符
func (*Options) GetAttrDelimiterColor ¶
GetAttrDelimiterColor 获取属性分隔符颜色
func (*Options) GetAttrPrefix ¶
GetAttrPrefix 获取属性前缀
func (*Options) GetAttrPrefixColor ¶
GetAttrPrefixColor 获取属性前缀颜色
func (*Options) GetAttrTextColor ¶
GetAttrTextColor 获取属性前缀颜色
func (*Options) GetCallerFormatter ¶
GetCallerFormatter 获取调用者格式化函数
func (*Options) GetLevelColor ¶
GetLevelColor 获取日志级别颜色
func (*Options) GetLevelText ¶
GetLevelText 获取日志级别文本
func (*Options) GetStackTrace ¶
GetStackTrace 获取堆栈追踪
func (*Options) GetStackTraceBeauty ¶
GetStackTraceBeauty 获取堆栈追踪是否美化
func (*Options) GetTimeLayout ¶
GetTimeLayout 获取当前日志的时间布局
func (*Options) IsDisabledCaller ¶
IsDisabledCaller 获取是否已经禁用调用者
func (*Options) IsDisabledColor ¶
IsDisabledColor 获取是否已经禁用颜色
func (*Options) WithCallerFormatter ¶
func (opt *Options) WithCallerFormatter(formatter func(file string, line int) (repFile, repLine string)) *Options
WithCallerFormatter 设置调用者格式化函数
- 该函数支持运行时设置
Click to show internal directories.
Click to hide internal directories.