Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomRecoveryWithZap ¶
func CustomRecoveryWithZap(logger *zap.Logger, stack bool, handler RecoveryFunc) gin.HandlerFunc
CustomRecoveryWithZap returns a gin.HandlerFunc (middleware) that recovers from any panics and logs requests using uber-go/zap. It will call the custom handler function to instead of return http status code 500. 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.
func RecoveryWithZap ¶
func RecoveryWithZap(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 ¶
type RecoveryFunc ¶
RecoveryFunc defines the function passable to CustomRecovery.