Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ginzap ¶
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().
It receives:
- A time package format string (e.g. time.RFC3339).
- A boolean stating whether to use UTC time zone or local.
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 RequestIndexer ¶
type RequestIndexer struct {
// contains filtered or unexported fields
}
func NewRequestIndexer ¶
func NewRequestIndexer(name string) *RequestIndexer
func (*RequestIndexer) Handle ¶
func (ri *RequestIndexer) Handle() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.