echo-logrus
Overview
Middleware echo-logrus is a logrus logger support for Echo.
This middleware is working on echo v3.
Getting Started
For dep users
When your project top dir run this.
$ dep ensure -add github.com/neko-neko/echo-logrus
Other users
Run this.
$ go get github.com/neko-neko/echo-logrus
Example
package main
import (
"os"
"time"
"github.com/Sirupsen/logrus"
"github.com/labstack/echo"
echoLog "github.com/labstack/gommon/log"
"github.com/neko-neko/echo-logrus"
"github.com/neko-neko/echo-logrus/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"))
}