logger

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package logger provides CLI logging with colored output using slog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIHandler

type CLIHandler struct {
	slog.Handler
	// contains filtered or unexported fields
}

CLIHandler implements slog.Handler with colored output for CLI applications.

func NewCLIHandlerWithOptions

func NewCLIHandlerWithOptions(
	out io.Writer,
	opts slog.HandlerOptions,
) *CLIHandler

NewCLIHandlerWithOptions creates a CLIHandler with the specified handler options.

func NewDefaultCLIHandler

func NewDefaultCLIHandler(
	out io.Writer,
) *CLIHandler

NewDefaultCLIHandler creates a CLIHandler with default options.

func NewDefaultCLIHandlerWithVerbosity

func NewDefaultCLIHandlerWithVerbosity(
	out io.Writer,
	verboseLevel slog.Level,
) *CLIHandler

NewDefaultCLIHandlerWithVerbosity creates a CLIHandler with a specific verbosity level.

func (*CLIHandler) Handle

func (h *CLIHandler) Handle(ctx context.Context, r slog.Record) error

Handle implements slog.Handler by formatting and outputting log records with colors.

type Log

type Log struct {
	ColorFunc  func(format string, a ...any) string
	Level      string
	Message    string
	Attributes string
}

Log represents a formatted log message with color and level information.

func (Log) String

func (l Log) String() string

Jump to

Keyboard shortcuts

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