logging

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerKey = "logger"
)

Constants for context keys

Variables

This section is empty.

Functions

func AuditLogger

func AuditLogger(logger *logrus.Logger) *logrus.Entry

AuditLogger logs audit events

func BusinessLogger

func BusinessLogger(logger *logrus.Logger) *logrus.Entry

BusinessLogger logs business events

func GetLoggerFromContext

func GetLoggerFromContext(c *gin.Context) *logrus.Entry

GetLoggerFromContext obtiene el logger del contexto

func LoggingMiddleware

func LoggingMiddleware(logger *logrus.Logger, config *LoggingConfig) gin.HandlerFunc

LoggingMiddleware middleware de logging estructurado

func RequestLogger

func RequestLogger(c *gin.Context, component string) *logrus.Entry

RequestLogger crea un logger específico para una request

func SecurityLogger

func SecurityLogger(logger *logrus.Logger) *logrus.Entry

SecurityLogger logs security events

func StructuredLoggerMiddleware

func StructuredLoggerMiddleware(logger *logrus.Logger) gin.HandlerFunc

StructuredLoggerMiddleware configura el logger estructurado para el contexto

Types

type LoggingConfig

type LoggingConfig struct {
	// Request/Response logging
	LogRequests    bool
	LogResponses   bool
	LogHeaders     bool
	LogBody        bool
	LogQueryParams bool

	// Performance logging
	LogSlowRequests bool
	SlowThreshold   time.Duration

	// Security logging
	LogFailedAuth bool
	LogSuspicious bool

	// Filtering
	SkipPaths   []string
	SkipMethods []string
	MaxBodySize int

	// Privacy
	SensitiveHeaders []string
	MaskSensitive    bool
}

LoggingConfig configuración del middleware de logging

func DefaultLoggingConfig

func DefaultLoggingConfig() *LoggingConfig

DefaultLoggingConfig retorna configuración por defecto

Jump to

Keyboard shortcuts

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