Skip to content

logrus-logger is a request logging middleware for Chi using Logrus logging library

License

Notifications You must be signed in to change notification settings

chi-middleware/logrus-logger

Repository files navigation

Chi logrus-logger middleware

logrus-logger is a request logging middleware for Chi using Logrus logging library

Documentation codecov Go Report Card Build Status

Usage

Import using:

import "github.com/chi-middleware/logrus-logger"

Use middleware with default (Info) logging level:

    log := logrus.New()

    r := chi.NewRouter()
    r.Use(logger.Logger("router", log))

or

Use middleware with Debug logging level:

    log := logrus.New()
    log.SetLevel(logrus.TraceLevel)

    r := chi.NewRouter()
    r.Use(logger.LoggerWithLevel("router", log, logrus.DebugLevel))