logger

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIHandler

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

CLIHandler provides clean output for CLI applications

func NewCLIHandler

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

NewCLIHandler creates a new CLI handler

func (*CLIHandler) Enabled

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

Enabled reports whether 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

func (*CLIHandler) WithAttrs

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

WithAttrs returns a new handler with the given attributes

func (*CLIHandler) WithGroup

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

WithGroup returns a new handler with the given group

type Logger

type Logger struct {
	*slog.Logger
}

Logger wraps slog.Logger with convenience methods

func NewCLILogger

func NewCLILogger() *Logger

NewCLILogger creates a new logger with CLI handler

func (*Logger) Error

func (l *Logger) Error(msg string)

Error logs an error message

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

Errorf logs a formatted error message

func (*Logger) Info

func (l *Logger) Info(msg string)

Info logs an info message

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof logs a formatted info message

func (*Logger) Warn

func (l *Logger) Warn(msg string)

Warn logs a warning message

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

Warnf logs a formatted warning message

Jump to

Keyboard shortcuts

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