Documentation
¶
Index ¶
- Constants
- Variables
- func Context() gin.HandlerFunc
- func GetDefaultLogFormatterWithRequestID() gin.LogFormatter
- func GetLoggerConfig(formatter gin.LogFormatter, output io.Writer, skipPaths []string) gin.LoggerConfig
- func Logger() gin.HandlerFunc
- func LoggerWithConfig(conf gin.LoggerConfig) gin.HandlerFunc
- func RequestID() gin.HandlerFunc
Constants ¶
const UsernameKey = "username"
UsernameKey defines the key in gin context which represents the owner of the secret.
const (
// XRequestIDKey defines X-Request-ID key string.
XRequestIDKey = "X-Request-ID"
)
Variables ¶
var Middlewares = defaultMiddlewares()
Middlewares store registered middlewares.
Functions ¶
func Context ¶
func Context() gin.HandlerFunc
Context is a middleware that injects common prefix fields to gin.Context.
func GetDefaultLogFormatterWithRequestID ¶
func GetDefaultLogFormatterWithRequestID() gin.LogFormatter
GetDefaultLogFormatterWithRequestID returns gin.LogFormatter with 'RequestID'.
func GetLoggerConfig ¶
func GetLoggerConfig(formatter gin.LogFormatter, output io.Writer, skipPaths []string) gin.LoggerConfig
GetLoggerConfig return gin.LoggerConfig which will write the logs to specified io.Writer with given gin.LogFormatter. By default gin.DefaultWriter = os.Stdout reference: https://github.com/gin-gonic/gin#custom-log-format
func Logger ¶
func Logger() gin.HandlerFunc
Logger instances a Logger middleware that will write the logs to gin.DefaultWriter. By default gin.DefaultWriter = os.Stdout.
func LoggerWithConfig ¶
func LoggerWithConfig(conf gin.LoggerConfig) gin.HandlerFunc
LoggerWithConfig instance a Logger middleware with config.
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.
Types ¶
This section is empty.