logger

package
v0.0.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggerMiddleware

func NewLoggerMiddleware(logger Logger) gin.HandlerFunc

NewLoggerMiddleware creates a Gin logging middleware using the provided logger. It logs HTTP requests with RFC3339 timestamp format and UTC timezone.

func NewRecoveryMiddleware

func NewRecoveryMiddleware(logger Logger) gin.HandlerFunc

NewRecoveryMiddleware creates a Gin recovery middleware that logs panics using the provided logger. It recovers from panics and logs them while keeping the HTTP stack intact.

func NewZapLoggerAdapter

func NewZapLoggerAdapter(logger Logger) ginzap.ZapLogger

NewZapLoggerAdapter creates a ginzap.ZapLogger adapter from a generic Logger interface. This allows using any logger implementation with gin-contrib/zap middleware.

func NewZapLoggerMiddleware

func NewZapLoggerMiddleware(logger ginzap.ZapLogger) gin.HandlerFunc

NewZapLoggerMiddleware creates a Gin logging middleware using a native ginzap.ZapLogger. This is useful when you already have a ginzap.ZapLogger implementation.

func NewZapRecoveryMiddleware

func NewZapRecoveryMiddleware(logger ginzap.ZapLogger) gin.HandlerFunc

Types

type Logger

type Logger interface {
	Info(msg string, args ...interface{})
	Error(msg string, args ...interface{})
}

Logger defines a minimal logging interface for HTTP request logging. It supports both info and error level logging with variadic arguments.

Jump to

Keyboard shortcuts

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