Versions in this module Expand all Collapse all v0 v0.6.1 Aug 17, 2024 v0.6.0 Aug 14, 2024 Changes in this version + const LevelDebug + const LevelError + const LevelInfo + const LevelWarn + func Debug(msg string, args ...any) + func Error(msg string, args ...any) + func Info(msg string, args ...any) + func NewMultiHandler(handlers ...slog.Handler) slog.Handler + func SetDefault(logger *Logger) + func Warn(msg string, args ...any) + type Attr = slog.Attr + func Any(key string, val any) Attr + func Bool(key string, val bool) Attr + func BoolP(key string, val *bool) Attr + func Duration(key string, val time.Duration) Attr + func DurationP(key string, val *time.Duration) Attr + func Err(err error) Attr + func Float32P[F constraints.Float](key string, val *F) Attr + func Float32[F constraints.Float](key string, val F) Attr + func Float64P[F constraints.Float](key string, val *F) Attr + func Float64[F constraints.Float](key string, val F) Attr + func FloatP[F constraints.Float](key string, val *F) Attr + func Float[F constraints.Float](key string, val F) Attr + func Group(key string, args ...any) Attr + func Int16P[I constraints.Int](key string, val *I) Attr + func Int16[I constraints.Int](key string, val I) Attr + func Int32P[I constraints.Int](key string, val *I) Attr + func Int32[I constraints.Int](key string, val I) Attr + func Int64P[I constraints.Int](key string, val *I) Attr + func Int64[I constraints.Int](key string, val I) Attr + func Int8P[I constraints.Int](key string, val *I) Attr + func Int8[I constraints.Int](key string, val I) Attr + func IntP[I constraints.Int](key string, val *I) Attr + func Int[I constraints.Int](key string, val I) Attr + func Skip(vs ...any) Attr + func Stack(key string) Attr + func StackData(key string, data []byte) Attr + func String(key, val string) Attr + func StringP(key string, val *string) Attr + func Time(key string, val time.Time) Attr + func TimeP(key string, val *time.Time) Attr + func Uint16P[I constraints.Int](key string, val *I) Attr + func Uint16[I constraints.Int](key string, val I) Attr + func Uint32P[I constraints.Int](key string, val *I) Attr + func Uint32[I constraints.Int](key string, val I) Attr + func Uint64P[I constraints.Int](key string, val *I) Attr + func Uint64[I constraints.Int](key string, val I) Attr + func Uint8P[I constraints.Int](key string, val *I) Attr + func Uint8[I constraints.Int](key string, val I) Attr + func UintP[I constraints.Int](key string, val *I) Attr + func Uint[I constraints.Int](key string, val I) Attr + type AttrKey uint16 + const AttrKeyCaller + const AttrKeyLevel + const AttrKeyMessage + const AttrKeyTime + type CallerFormatter func(file string, line int) (repFile, repLine string) + type ColorType uint16 + const ColorTypeAttrDelimiter + const ColorTypeAttrErrorKey + const ColorTypeAttrErrorValue + const ColorTypeAttrKey + const ColorTypeAttrValue + const ColorTypeCaller + const ColorTypeDebugLevel + const ColorTypeErrorLevel + const ColorTypeErrorTrack + const ColorTypeErrorTrackHeader + const ColorTypeInfoLevel + const ColorTypeMessage + const ColorTypeTime + const ColorTypeWarnLevel + type FunctionalLoggerProvider func() *Logger + func (f FunctionalLoggerProvider) Provide() *Logger + type GNetLogger struct + Logger *Logger + func NewGNetLogger(logger *Logger) *GNetLogger + func (l *GNetLogger) Debugf(format string, args ...interface{}) + func (l *GNetLogger) Errorf(format string, args ...interface{}) + func (l *GNetLogger) Fatalf(format string, args ...interface{}) + func (l *GNetLogger) Infof(format string, args ...interface{}) + func (l *GNetLogger) Warnf(format string, args ...interface{}) + type Handler struct + func NewHandler(w io.Writer, opts ...*HandlerOptions) *Handler + func (h *Handler) Enabled(ctx context.Context, level slog.Level) bool + func (h *Handler) Handle(ctx context.Context, record slog.Record) error + func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler + func (h *Handler) WithGroup(name string) slog.Handler + type HandlerOption func(opts *HandlerOptions) + type HandlerOptions struct + AttrKeys map[AttrKey]string + Caller bool + CallerFormatter CallerFormatter + CallerSkip int + ColorTypes map[ColorType]*color.Color + Delimiter string + EnableColor bool + ErrTrackLevel map[Level]struct{} + LevelStr map[Level]string + MessageFormatter MessageFormatter + TimeLayout string + TrackBeautify bool + func NewDevGolandHandlerOptions() *HandlerOptions + func NewDevHandlerOptions() *HandlerOptions + func NewProdHandlerOptions() *HandlerOptions + func NewTestHandlerOptions() *HandlerOptions + func (o *HandlerOptions) WithAttrKey(key AttrKey, value string) *HandlerOptions + func (o *HandlerOptions) WithCaller(caller bool) *HandlerOptions + func (o *HandlerOptions) WithCallerFormatter(formatter CallerFormatter) *HandlerOptions + func (o *HandlerOptions) WithCallerSkip(skip int) *HandlerOptions + func (o *HandlerOptions) WithColor(colorType ColorType, attrs ...color.Attribute) *HandlerOptions + func (o *HandlerOptions) WithDelimiter(delimiter string) *HandlerOptions + func (o *HandlerOptions) WithEnableColor(enable bool) *HandlerOptions + func (o *HandlerOptions) WithErrTrackLevel(levels ...slog.Level) *HandlerOptions + func (o *HandlerOptions) WithLevel(level Leveler) *HandlerOptions + func (o *HandlerOptions) WithLevelStr(level slog.Level, str string) *HandlerOptions + func (o *HandlerOptions) WithMessageFormatter(formatter MessageFormatter) *HandlerOptions + func (o *HandlerOptions) WithTimeLayout(layout string) *HandlerOptions + func (o *HandlerOptions) WithTrackBeautify(beautify bool) *HandlerOptions + type Level = slog.Level + type LevelVar = slog.LevelVar + type Leveler = slog.Leveler + type Logger = slog.Logger + func GetDefault() *Logger + func New(handler slog.Handler) *Logger + func NewSilentLogger() *Logger + type LoggerProvider interface + Provide func() *Logger + type MessageFormatter func(message string) string + type MultiHandler struct + func (h MultiHandler) Enabled(ctx context.Context, level slog.Level) bool + func (h MultiHandler) Handle(ctx context.Context, record slog.Record) (err error) + func (h MultiHandler) WithAttrs(attrs []slog.Attr) slog.Handler + func (h MultiHandler) WithGroup(name string) slog.Handler + type SilentHandler struct + func (s SilentHandler) Enabled(ctx context.Context, level slog.Level) bool + func (s SilentHandler) Handle(ctx context.Context, record slog.Record) error + func (s SilentHandler) WithAttrs(attrs []slog.Attr) slog.Handler + func (s SilentHandler) WithGroup(name string) slog.Handler