logger

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 5 Imported by: 12

README

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))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(category string, logger logrus.FieldLogger) func(h http.Handler) http.Handler

func LoggerWithLevel added in v0.3.0

func LoggerWithLevel(category string, logger logrus.FieldLogger, level logrus.Level) func(h http.Handler) http.Handler

Logger returns a request logging middleware

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL