Documentation ¶
Index ¶
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Enabled(ctx context.Context, level slog.Level) bool
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func Handler() slog.Handler
- func Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func Init(opts ...Option)
- func InitDefaultLogger()
- func Log(ctx context.Context, level slog.Level, msg string, args ...any)
- func LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)
- func Panic(msg string, args ...any)
- func PanicContext(ctx context.Context, msg string, args ...any)
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func WithJSON(c *Config)
- func WithSource(c *Config)
- type Config
- type Logger
- type Option
- func WithLevel(lvl slog.Leveler) Option
- func WithLevelListener(listener func() slog.Level, tick time.Duration) Option
- func WithPrefix(prefix string) Option
- func WithReplaceAttr(repl ...func(groups []string, a slog.Attr) slog.Attr) Option
- func WithTimeFormat(format string) Option
- func WithWriter(w io.Writer) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDefaultLogger ¶
func InitDefaultLogger()
func WithSource ¶
func WithSource(c *Config)
Types ¶
type Config ¶
type Config struct { slog.HandlerOptions // contains filtered or unexported fields }
type Logger ¶
type Logger interface { Handler() slog.Handler With(args ...any) Logger WithGroup(name string) Logger Enabled(ctx context.Context, level slog.Level) bool Log(ctx context.Context, level slog.Level, msg string, args ...any) LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr) Debug(msg string, args ...any) DebugContext(ctx context.Context, msg string, args ...any) Info(msg string, args ...any) InfoContext(ctx context.Context, msg string, args ...any) Warn(msg string, args ...any) WarnContext(ctx context.Context, msg string, args ...any) Error(msg string, args ...any) ErrorContext(ctx context.Context, msg string, args ...any) Panic(msg string, args ...any) PanicContext(ctx context.Context, msg string, args ...any) }
func NewDefaultLogger ¶
func NewDefaultLogger() Logger
type Option ¶
type Option func(c *Config)
func WithLevelListener ¶
func WithPrefix ¶
func WithReplaceAttr ¶
func WithTimeFormat ¶
func WithWriter ¶
Click to show internal directories.
Click to hide internal directories.