Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 611 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 611 Bytes

chi-logger

chi-logger is a simple logging middleware for Chi with support for Zap and Logrus

Installation

go get github.com/766b/chi-logger

Usage with Logrus

logger := logrus.New()

r := chi.NewRouter()
r.Use(middleware.RequestID)
r.Use(middleware.RealIP)
r.Use(chilogger.NewLogrusMiddleware("router", logger))
...

Usage with Zap

logger, _ := zap.NewProduction()

r := chi.NewRouter()
r.Use(middleware.RequestID)
r.Use(middleware.RealIP)
r.Use(chilogger.NewZapMiddleware("router", logger))
...