log

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearLogs added in v0.7.0

func ClearLogs()

ClearLogs clears the console.

func DurStr added in v0.11.0

func DurStr(d time.Duration) string

DurStr formats a duration in a human-friendly way.

func Fatalf

func Fatalf(f string, v ...any)

Fatalf prints an error line to stderr and exits with code 1.

Types

type Handler added in v0.11.0

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

Handler is an slog.Handler that produces the same pretty colored output as the original templier log package.

func NewHandler added in v0.11.0

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

NewHandler creates a new colored slog.Handler writing to out. The level controls which messages are emitted. LinePrefix defaults to "🤖 " and TimeFormat defaults to "3:04:05.000 PM".

func (*Handler) Enabled added in v0.11.0

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

func (*Handler) Handle added in v0.11.0

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

func (*Handler) SetLinePrefix added in v0.11.0

func (h *Handler) SetLinePrefix(prefix string)

SetLinePrefix sets the prefix printed at the beginning of each log line.

func (*Handler) SetTimeFormat added in v0.11.0

func (h *Handler) SetTimeFormat(format string)

SetTimeFormat sets the time format string used for timestamps.

func (*Handler) WithAttrs added in v0.11.0

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

func (*Handler) WithGroup added in v0.11.0

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

Jump to

Keyboard shortcuts

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