middleware

package
v0.0.0-...-a39f72a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const UsernameKey = "username"
View Source
const (
	XRequestIDKey = "X-Request-ID"
)

Variables

View Source
var Middlewares = defaultMiddlewares()

Functions

func Context

func Context() gin.HandlerFunc

Context is a middleware that injects common prefix fields to gin.Context.

func Logger

func Logger() gin.HandlerFunc

Logger middleware

func RequestID

func RequestID() gin.HandlerFunc

RequestID is a middleware that injects a 'X-Request-ID' into the context and request/response header of each request.

func Secure

func Secure(c *gin.Context)

Secure is a middleware function that appends security and resource access headers.

Types

type LoggerOptions

type LoggerOptions struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(opts *LoggerOptions) *LoggerOptions

NewLogger init

func (*LoggerOptions) Config

func (l *LoggerOptions) Config() *logrus.Logger

initConfig configs logrus.

Jump to

Keyboard shortcuts

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