log

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SuccessKey = "_success"

Special attribute key for marking success messages

Variables

This section is empty.

Functions

func Success

func Success() slog.Attr

Success returns an Attr that marks a log message as a success message

Types

type ColorMode

type ColorMode int

ColorMode represents the color capability of the terminal

const (
	ColorModeNone ColorMode = iota
	ColorMode16
	ColorMode256
)

type Handler

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

Handler is a custom slog handler that formats log output without timestamps or levels

func NewHandler

func NewHandler(w io.Writer, level slog.Leveler) *Handler

NewHandler creates a new Handler

func (*Handler) Enabled

func (h *Handler) Enabled(_ context.Context, level slog.Level) bool

Enabled reports whether the handler handles records at the given level

func (*Handler) Handle

func (h *Handler) Handle(_ context.Context, r slog.Record) error

Handle formats and writes a log record

func (*Handler) WithAttrs

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

WithAttrs returns a new Handler with the given attributes

func (*Handler) WithGroup

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

WithGroup returns a new Handler with the given group

Jump to

Keyboard shortcuts

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