chilogger

package module
v0.0.0-...-23fe43d Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: MIT Imports: 5 Imported by: 0

README

chi-zap-ecs-logger

forked from github.com/766b/chi-logger

chi-zap-ecs-logger is a simple logging middleware for Chi with support for Zap
Changed from 766b/chi-logger to use ecs defined fields, logrus removed

Installation

go get github.com/igknot/chi-zap-ecs-logger

Usage with Zap

logger, _ := zap.NewProduction()

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewZapMiddleware

func NewZapMiddleware(name string, logger *zap.Logger) func(next http.Handler) http.Handler

NewZapMiddleware returns a new Zap Middleware handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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