Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 898 Bytes

File metadata and controls

38 lines (27 loc) · 898 Bytes

Log

License

Log is a simple go logging package that is a wrapper aroung slog.

Install

go get github.com/RevittCo/log

Handler Interface

You can create your own handler for use with this package. Just make it implement this interface.

type Handler interface {
    Enabled(ctx context.Context, l slog.Level) bool
    Handle(ctx context.Context, r slog.Record) error
    WithAttrs(attrs []slog.Attr) slog.Handler
    WithGroup(name string) slog.Handler
}

Usage

log.SetDefault(log.NewLogger(log.NewTerminalHandler(os.Stdout, log.LevelInfo)))
log.Info("logger initialised")