logger

package
v0.0.0-dev.cc7866f Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logger provides colored console logging with configurable log levels.

Index

Constants

This section is empty.

Variables

View Source
var Logger *slog.Logger

Logger is the global logger instance used throughout the application.

Functions

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the global logger instance.

Types

type ColorHandler

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

ColorHandler wraps a slog.Handler to add color to log levels

func NewColorHandler

func NewColorHandler(w io.Writer, opts *slog.HandlerOptions) *ColorHandler

NewColorHandler creates a new colored log handler for terminal output.

func (*ColorHandler) Enabled

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

Enabled reports whether the handler handles records at the given level.

func (*ColorHandler) Handle

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

Handle formats and writes a log record with color coding.

func (*ColorHandler) WithAttrs

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

WithAttrs returns a new ColorHandler with the given attributes added.

func (*ColorHandler) WithGroup

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

WithGroup returns a new ColorHandler with the given group name added.

Jump to

Keyboard shortcuts

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