logger

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs a debug message (only shown when verbose is enabled)

func Error

func Error(msg string, args ...any)

Error logs an error message

func Fatal

func Fatal(msg string, args ...any)

Fatal logs an error message and exits with status 1

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the global logger instance

func Info

func Info(msg string, args ...any)

Info logs an informational message

func IsRawMode

func IsRawMode() bool

IsRawMode returns whether raw mode is enabled

func SetLogLevel

func SetLogLevel(level slog.Level)

SetLogLevel sets the log level explicitly

func SetLogLevelString

func SetLogLevelString(level string)

SetLogLevelString sets the log level from a string (debug, info, warn, error)

func SetRawMode

func SetRawMode(raw bool)

SetRawMode enables or disables raw mode (bypasses all logging)

func SetVerbose

func SetVerbose(verbose bool)

SetVerbose sets the log level based on verbose flag

func Warn

func Warn(msg string, args ...any)

Warn logs a warning message

Types

type CompactHandler

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

CompactHandler is a custom slog handler that formats messages cleanly

func NewCompactHandler

func NewCompactHandler(w io.Writer, opts *slog.HandlerOptions) *CompactHandler

func (*CompactHandler) Enabled

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

func (*CompactHandler) Handle

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

func (*CompactHandler) WithAttrs

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

func (*CompactHandler) WithGroup

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

Jump to

Keyboard shortcuts

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