forked from mirror/gin-logrus
4b2c7d212a
By using the FieldLogger interface the logger supports both new logrus loggers and existing field loggers such as an entry. This is useful if the enduser uses an existing logrus logger with existing fields. |
||
---|---|---|
.gitignore | ||
LICENSE | ||
README.md | ||
logger.go |
README.md
gin-logrus
Logrus logger middleware for Gin
Usage
import (
"github.com/Sirupsen/logrus"
"github.com/toorop/gin-logrus"
"github.com/gin-gonic/gin"
log := logrus.New()
// hooks, config,...
r := gin.New()
r.Use(ginlogrus.Logger(log), gin.Recovery())
// pingpong
r.GET("/ping", func(c *gin.Context) {
c.Data(200, "text/plain", []byte("pong"))
})
r.Run("127.0.0.1:8080")