gin

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 8 Imported by: 1

README

Middleware

Package contains common shared Go Gin Middleware.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContextOrDiscard added in v0.0.9

func FromContextOrDiscard(c *gin.Context) logr.Logger

func Logger added in v0.0.3

func Logger(cfg LogConfig) gin.HandlerFunc

func NewEngine added in v0.0.3

func NewEngine(cfg Config) *gogin.Engine

Types

type Config added in v0.0.3

type Config struct {
	LogConfig     LogConfig
	MetricsConfig MetricsConfig
}

func DefaultConfig added in v0.0.3

func DefaultConfig() Config

type LogConfig added in v0.0.3

type LogConfig struct {
	// Logger instance to output request logs.
	Logger logr.Logger
	// Regex used to filter out request logs.
	PathFilter *regexp.Regexp
	// Should request logs should include latency.
	IncludeLatency bool
	// Should request logs should include client IP.
	IncludeClientIP bool
	// Context keys to include in request log.
	IncludeKeys []string
}

type MetricsConfig added in v0.0.3

type MetricsConfig struct {
	// Service is used to differentiate between multiple metrics handlers.
	Service string
	// Handler ID to use when using dynamic path parameters.
	HandlerID string
}

Jump to

Keyboard shortcuts

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