gin middleware for logrus
Switch branches/tags
Nothing to show
Clone or download
Latest commit 5d05462 Jun 29, 2018
Permalink
Failed to load latest commit information.
.gitignore Initial commit Sep 26, 2016
LICENSE Initial commit Sep 26, 2016
README.md add doc Sep 26, 2016
logger.go fix #3 Jun 29, 2018

README.md

gin-logrus

Logrus logger middleware for Gin

golang gin middleware logrus logger

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")