logging

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCLILogger

func NewCLILogger(level slog.Level) *slog.Logger

NewCLILogger creates a new logger with CLI-friendly output format.

func ParseLogLevel

func ParseLogLevel(level string) slog.Level

ParseLogLevel converts a string to slog.Level.

func SetDefaultCLILogger

func SetDefaultCLILogger(level slog.Level)

SetDefaultCLILogger initializes the CLI logger and sets it as the default.

Types

type CLIHandler

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

CLIHandler is a custom slog.Handler for CLI output.

func NewCLIHandler

func NewCLIHandler(w io.Writer, level slog.Level) *CLIHandler

NewCLIHandler creates a new CLI handler that writes to the given writer.

func (*CLIHandler) Enabled

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

Enabled returns true if the handler handles records at the given level.

func (*CLIHandler) Handle

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

Handle formats and writes the log record with attributes.

func (*CLIHandler) WithAttrs

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

WithAttrs returns a new handler with the given attributes.

func (*CLIHandler) WithGroup

func (h *CLIHandler) WithGroup(_ 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