Gin middleware for Logging with Logrus. It is meant as drop in replacement for the default logger used in Gin.
- github.com/gin-gonic/gin
- github.com/sirupsen/logrus
go get github.com/rocksolidlabs/gin-logrus
package main
import (
"flag"
"time"
log "github.com/sirupsen/logrus"
"github.com/rocksolidlabs/gin-logrus"
"github.com/gin-gonic/gin"
)
func main() {
flag.Parse()
router := gin.New()
router.Use(ginlogrus. Logger("MYAPI", false, true, os.Stdout, logrus.WarnLevel))
//..
router.Use(gin.Recovery())
log.Info("API Running")
router.Run(":8080")
}
https://github.com/zalando/gin-glog
See LICENSE file.