Documentation ¶
Overview ¶
Package ginzap provides a logging middleware to get https://github.com/uber-go/zap as logging library for https://github.com/gin-gonic/gin. It can be used as replacement for the internal logging middleware http://godoc.org/github.com/gin-gonic/gin#Logger.
This package is heavily based on https://github.com/szuecs/gin-glog
Example:
package main import ( "flag "time" "github.com/golang/glog" "github.com/akath19/gin-zap" "github.com/gin-gonic/gin" ) func main() { flag.Parse() router := gin.New() logger := zap.NewProduction() router.Use(ginzap.Logger(3 * time.Second, logger)) //.. router.Use(gin.Recovery()) logger.Info("Gin bootstrapped with Zap") router.Run(":8080") }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorLogger ¶
func ErrorLogger() gin.HandlerFunc
ErrorLogger returns a gin handler func for errors
func ErrorLoggerT ¶
func ErrorLoggerT(t gin.ErrorType) gin.HandlerFunc
ErrorLoggerT returns a gin handler middleware with the given type gin.ErrorType.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.