ginMiddleWare

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinZap

func GinZap(w logx.Writer, timeFormat string, utc bool) gin.HandlerFunc

Ginzap returns a gin.HandlerFunc (middleware) that logs requests using uber-go/zap.

Requests with errors are logged using zap.Error(). Requests without errors are logged using zap.Info().

It receives:

  1. A time package format string (e.g. time.RFC3339).
  2. A boolean stating whether to use UTC time zone or local.

func GinZapWithConfig

func GinZapWithConfig(w logx.Writer, conf *Config) gin.HandlerFunc

func NewCachedReadCloser

func NewCachedReadCloser(rc io.ReadCloser) *cachedReadCloser

func NewCachedResponseWriter

func NewCachedResponseWriter(w gin.ResponseWriter) *cachedResponseWriter

func RecoveryWithZap

func RecoveryWithZap(w logx.Writer, stack bool) gin.HandlerFunc

func TimeOut

func TimeOut(d time.Duration) gin.HandlerFunc

func Translations

func Translations() gin.HandlerFunc

Types

type Config

type Config struct {
	TimeFormat string
	UTC        bool
	SkipPaths  []string
	TraceID    bool // optionally log Open Telemetry TraceID

	// If true, log without request/response body.
	DisableBody bool
}

Config is config setting for Ginzap

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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