logging

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeURL

func SanitizeURL(raw string) string

SanitizeURL removes userinfo and query params for logging to avoid leaking secrets. Returns the URL without userinfo and query, preserving scheme, host, and path.

Types

type Level

type Level int

Level represents log severity.

const (
	Debug Level = iota
	Info
	Warn
	Error
)

func ParseLevel

func ParseLevel(s string) Level

type Logger

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

func New

func New(level string, jsonOut bool) *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(format string, a ...any)

func (*Logger) Enabled

func (l *Logger) Enabled(v Level) bool

func (*Logger) Errorf

func (l *Logger) Errorf(format string, a ...any)

func (*Logger) Infof

func (l *Logger) Infof(format string, a ...any)

func (*Logger) Warnf

func (l *Logger) Warnf(format string, a ...any)

func (*Logger) WarnfThrottled

func (l *Logger) WarnfThrottled(key string, window time.Duration, format string, a ...any)

WarnfThrottled logs a warning at most once per window for a given key. Repeated calls within the window are suppressed and summarized on the next log.

Jump to

Keyboard shortcuts

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