logger

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset              = "\033[0m"
	White              = "\033[37m"
	WhiteDim           = "\033[37;2m"
	Green              = "\033[32m"
	GreenDimUnderlined = "\033[32;2;4m"
	Magenta            = "\033[35m"
	BrightRed          = "\033[91m"
	BrightYellow       = "\033[93m"
	Cyan               = "\033[36m"
	CyanDim            = "\033[36;2m"
)

https://en.wikipedia.org/wiki/ANSI_escape_code

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler is very similar to slog's commonHandler

func NewHandler

func NewHandler(out io.Writer, opts Options) *Handler

func (*Handler) Enabled

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

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, record slog.Record) error

func (*Handler) WithAttrs

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

func (*Handler) WithGroup

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

type Options

type Options struct {
	AddSource  bool
	Colored    bool
	Level      slog.Leveler
	TimeFormat string
}

Jump to

Keyboard shortcuts

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