gin middleware for logrus
Go to file
Stéphane Depierrepont 2c785434f2
Merge pull request #9 from kasperfrederiksen/patch-1
Fix logrus import statement in usage section
2021-02-25 10:29:05 +01:00
.gitignore Initial commit 2016-09-26 13:53:39 +02:00
LICENSE Initial commit 2016-09-26 13:53:39 +02:00
README.md Fix logrus import statement in usage section 2021-02-18 16:09:50 +01:00
logger.go optionally skip paths to log 2020-08-18 09:15:07 +02:00

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