Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toorop/gin-logrus
gin middleware for logrus
https://github.com/toorop/gin-logrus
Last synced: about 6 hours ago
JSON representation
gin middleware for logrus
- Host: GitHub
- URL: https://github.com/toorop/gin-logrus
- Owner: toorop
- License: mit
- Created: 2016-09-26T11:53:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-25T09:29:05.000Z (over 3 years ago)
- Last Synced: 2024-08-04T10:16:13.944Z (3 months ago)
- Language: Go
- Size: 8.79 KB
- Stars: 106
- Watchers: 4
- Forks: 27
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gin-logrus
[Logrus](https://github.com/Sirupsen/logrus) logger middleware for [Gin](https://gin-gonic.github.io/gin/)
![golang gin middleware logrus logger](http://i.imgur.com/P140Vi0.png)
## Usage
```go
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")
```