logging

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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