Skip to content

alexferl/echo-logrusmiddleware

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

echo-logrusmiddleware

logrus middleware

An adapter (middleware) to make the Golang Echo web framework logging work with logrus, an excellent logging solution.

Improves upon sandalwing/echo-logrusmiddleware by:

  1. Using the correct import for logrus
  2. Including the request_id prop in the log output in order to support Echo's request ID middleware.
  3. Supporting Echo v4

Install

$ go get github.com/alexferl/echo-logrusmiddleware

Usage

package main

import (
	"github.com/alexferl/echo-logrusmiddleware"
	"github.com/labstack/echo/v4"
	"github.com/sirupsen/logrus"
)

func main() {
	e := echo.New()

	// echo Logger interface friendly wrapper around logrus logger to use it
	// for default echo logger
	e.Logger = logrusmiddleware.Logger{logrus.StandardLogger()}
	e.Use(logrusmiddleware.Hook())

	// do the rest of your echo setup, routes, listen on server, etc..
}

About

An adapter to make the Golang Echo web framework logging work with github.com/Sirupsen/logrus.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%