Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 540 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 540 Bytes

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