Documentation
¶
Index ¶
- Constants
- func AuditLogger(logger *logrus.Logger) *logrus.Entry
- func BusinessLogger(logger *logrus.Logger) *logrus.Entry
- func GetLoggerFromContext(c *gin.Context) *logrus.Entry
- func LoggingMiddleware(logger *logrus.Logger, config *LoggingConfig) gin.HandlerFunc
- func RequestLogger(c *gin.Context, component string) *logrus.Entry
- func SecurityLogger(logger *logrus.Logger) *logrus.Entry
- func StructuredLoggerMiddleware(logger *logrus.Logger) gin.HandlerFunc
- type LoggingConfig
Constants ¶
View Source
const (
LoggerKey = "logger"
)
Constants for context keys
Variables ¶
This section is empty.
Functions ¶
func AuditLogger ¶
AuditLogger logs audit events
func BusinessLogger ¶
BusinessLogger logs business events
func GetLoggerFromContext ¶
GetLoggerFromContext obtiene el logger del contexto
func LoggingMiddleware ¶
func LoggingMiddleware(logger *logrus.Logger, config *LoggingConfig) gin.HandlerFunc
LoggingMiddleware middleware de logging estructurado
func RequestLogger ¶
RequestLogger crea un logger específico para una request
func SecurityLogger ¶
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
Click to show internal directories.
Click to hide internal directories.