middleware

package
v0.0.0-...-29e02a0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

  • @Name:
  • @Descripttion:
  • @Warning:
  • @version:
  • @Author: moo
  • @Date: 2020-10-29 14:11:54
  • @LastEditors: moo
  • @LastEditTime: 2020-10-29 14:12:28

跨域中间件

  • @Descripttion:
  • @version:
  • @Author: moo
  • @Date: 2020-10-23 12:01:31
  • @LastEditors: moo
  • @LastEditTime: 2021-05-27 19:13:23

Index

Constants

View Source
const MAX_INPUT_FORM_SIZE int64 = 1024

Variables

This section is empty.

Functions

func CoreHandleZap

func CoreHandleZap(logger *zap.Logger, timeFormat string, utc bool, debug bool) gin.HandlerFunc

func Cors

func Cors() gin.HandlerFunc

func DebugHandleWithResp

func DebugHandleWithResp(logger *zap.Logger, timeFormat string, utc bool, debug bool) gin.HandlerFunc

*

  • @name: CoreHandle
  • @description:
  • 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()
  • @warning: 针对c.String() 之类的写法,response目前写法获取不到
  • @msg:
  • @param {*zap.Logger} logger
  • @param {string} timeFormat: A time package format string (e.g. time.RFC3339).
  • @param {bool} utc: A boolean stating whether to use UTC time zone or local.
  • @param {bool} debug
  • @return {*}

func Recovery

func Recovery(logger *zap.Logger, stack bool) gin.HandlerFunc

RecoveryWithZap returns a gin.HandlerFunc (middleware) that recovers from any panics and logs requests using uber-go/zap. All errors are logged using zap.Error(). stack means whether output the stack info. The stack info is easy to find where the error occurs but the stack info is too large.

Types

This section is empty.

Jump to

Keyboard shortcuts

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