vlog

package module
v0.0.0-...-673e084 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 11 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BufferedWriteSyncer

func BufferedWriteSyncer(filename string, maxSize, maxBackups, maxAge int) *zapcore.BufferedWriteSyncer

func Debug

func Debug(msg string, args ...any)

func Debugf

func Debugf(format string, args ...any)

func Error

func Error(msg string, args ...any)

func Errorf

func Errorf(format string, args ...any)

func G

func G() *slog.Logger

func Info

func Info(msg string, args ...any)

func Infof

func Infof(format string, args ...any)

func New

func New(filename string, ws ...io.Writer) error

func NewMultiHandler

func NewMultiHandler(hs ...slog.Handler) slog.Handler

func NewV2

func NewV2(ws []io.Writer, opts *slog.HandlerOptions)

func Sync

func Sync()

func Warn

func Warn(msg string, args ...any)

func Warnf

func Warnf(format string, args ...any)

Types

type Config

type Config struct {
	Level     *slog.LevelVar
	WithLevel bool
	Opts      *slog.HandlerOptions
	WithOpts  bool
	Output    io.Writer
}

type MultiHandler

type MultiHandler struct {
	// contains filtered or unexported fields
}

func (*MultiHandler) Enabled

func (m *MultiHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*MultiHandler) Handle

func (m *MultiHandler) Handle(ctx context.Context, r slog.Record) error

func (*MultiHandler) WithAttrs

func (m *MultiHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*MultiHandler) WithGroup

func (m *MultiHandler) WithGroup(name string) slog.Handler

type Option

type Option interface {
	Apply(cfg *Config)
}

func WithHandlerOptions

func WithHandlerOptions(opts *slog.HandlerOptions) Option

func WithLevel

func WithLevel(lvl *slog.LevelVar) Option

func WithOutput

func WithOutput(writer io.Writer) Option

type OptionFunc

type OptionFunc func(cfg *Config)

func (OptionFunc) Apply

func (fn OptionFunc) Apply(cfg *Config)

type PrettyHandler

type PrettyHandler struct {
	// contains filtered or unexported fields
}

func NewPrettyHandler

func NewPrettyHandler(opts *slog.HandlerOptions) *PrettyHandler

func (*PrettyHandler) Enabled

func (h *PrettyHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*PrettyHandler) Handle

func (h *PrettyHandler) Handle(ctx context.Context, r slog.Record) error

func (*PrettyHandler) WithAttrs

func (h *PrettyHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*PrettyHandler) WithGroup

func (h *PrettyHandler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL