logging

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

func Error

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

func Info

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

Helper functions for global logger

func Init

func Init(level slog.Level)

Init initializes global logger

func Warn

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

Types

type Logger

type Logger struct {
	*slog.Logger
}

Logger wraps slog with structured logging

func Global

func Global() *Logger

Global returns global logger

func New

func New(level slog.Level) *Logger

New creates a structured logger

func (*Logger) Command

func (l *Logger) Command(cmd string, args []string, duration int64)

Command logs command execution

func (*Logger) Database

func (l *Logger) Database(operation string, duration int64, err error)

Database logs database operations

func (*Logger) Filter

func (l *Logger) Filter(name string, input, output, saved int)

Filter logs filter application

func (*Logger) RateLimit

func (l *Logger) RateLimit(clientIP string, allowed bool)

RateLimit logs rate limit events

func (*Logger) Validation

func (l *Logger) Validation(field string, value any, valid bool, reason string)

Validation logs validation events

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) *Logger

WithContext adds context fields

func (*Logger) WithError

func (l *Logger) WithError(err error) *Logger

WithError adds error field

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[string]any) *Logger

WithFields adds multiple fields

Jump to

Keyboard shortcuts

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