package module
Version: v0.0.0-...-64eebe8 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 7 Imported by: 0


Logrus logger adapter for Echo


Simple adapter for Logrus logger for Echo.

Advantages over other implementations:

  • doesn't use unconfigurable singleton logger
  • doesn't panic when it shouldn't (and I believe such adapter should NEVER panic)


e := echo.New()

logger := logrus.New() // or use `logrus.StandardLogger()` for predefined singleton

// Logger adapter is used by `echo.Echo`
adapter := echologrus.LoggerAdapter{logger}
e.Logger = adapter

// Logger middleware
middleware := echologrus.Middleware(logger)
// or
middleware := echologrus.Middleware(logger, echologrus.WithSkipper(...))





This section is empty.


This section is empty.


func Middleware

func Middleware(logger *logrus.Logger, opts ...Option) echo.MiddlewareFunc


type LoggerAdapter

type LoggerAdapter struct {

func NewAdapter

func NewAdapter(logger *logrus.Logger) *LoggerAdapter

func (LoggerAdapter) Debugj

func (adapter LoggerAdapter) Debugj(j log.JSON)

func (LoggerAdapter) Errorj

func (adapter LoggerAdapter) Errorj(j log.JSON)

func (LoggerAdapter) Fatalj

func (adapter LoggerAdapter) Fatalj(j log.JSON)

func (LoggerAdapter) Infoj

func (adapter LoggerAdapter) Infoj(j log.JSON)

func (LoggerAdapter) Level

func (adapter LoggerAdapter) Level() log.Lvl

func (LoggerAdapter) Output

func (adapter LoggerAdapter) Output() io.Writer

func (LoggerAdapter) Panicj

func (adapter LoggerAdapter) Panicj(j log.JSON)

func (LoggerAdapter) Prefix

func (adapter LoggerAdapter) Prefix() string

Log format is completely determined by logrus

func (LoggerAdapter) Printj

func (adapter LoggerAdapter) Printj(j log.JSON)

func (LoggerAdapter) SetHeader

func (adapter LoggerAdapter) SetHeader(string)

Log format is completely determined by logrus

func (LoggerAdapter) SetLevel

func (adapter LoggerAdapter) SetLevel(log.Lvl)

Ignore level as Logger shouldn't be configured by echo.Echo anyway

func (LoggerAdapter) SetPrefix

func (adapter LoggerAdapter) SetPrefix(p string)

Log format is completely determined by logrus

func (LoggerAdapter) Warnj

func (adapter LoggerAdapter) Warnj(j log.JSON)

type Option

type Option func(*config)

func WithSkipper

func WithSkipper(skipper middleware.Skipper) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL