https://github.com/neko-neko/echo-logrus
echo-logrus is a middleware that provides logrus logger support for echo.
https://github.com/neko-neko/echo-logrus
echo go golang labstack-echo middleware
Last synced: 11 months ago
JSON representation
echo-logrus is a middleware that provides logrus logger support for echo.
- Host: GitHub
- URL: https://github.com/neko-neko/echo-logrus
- Owner: neko-neko
- License: mit
- Created: 2017-10-14T15:40:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-09T17:44:12.000Z (almost 3 years ago)
- Last Synced: 2025-03-18T11:48:12.399Z (11 months ago)
- Topics: echo, go, golang, labstack-echo, middleware
- Language: Go
- Size: 2.51 MB
- Stars: 35
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# echo-logrus
[](https://travis-ci.org/neko-neko/echo-logrus)
[](https://goreportcard.com/report/github.com/neko-neko/echo-logrus)
[](https://raw.githubusercontent.com/neko-neko/echo-logrus/master/LICENSE)
## Overview
Middleware echo-logrus is a [logrus](https://github.com/sirupsen/logrus) logger support for [Echo](https://github.com/labstack/echo).
This middleware is working on Echo v4.
## Getting Started
### For [dep](https://github.com/golang/dep) users
When your project top dir run this.
```bash
$ dep ensure -add github.com/neko-neko/echo-logrus
```
### Modules users
```bash
$ go get github.com/neko-neko/echo-logrus/v2
```
## Example
```go
package main
import (
"os"
"time"
"github.com/sirupsen/logrus"
"github.com/labstack/echo/v4"
echoLog "github.com/labstack/gommon/log"
"github.com/neko-neko/echo-logrus/v2"
"github.com/neko-neko/echo-logrus/v2/log"
)
func main() {
e := echo.New()
// Logger
log.Logger().SetOutput(os.Stdout)
log.Logger().SetLevel(echoLog.INFO)
log.Logger().SetFormatter(&logrus.JSONFormatter{
TimestampFormat: time.RFC3339,
})
e.Logger = log.Logger()
e.Use(middleware.Logger())
log.Info("Logger enabled!!")
e.Logger.Fatal(e.Start(":1323"))
}
```