Skip to content

Lavalier/zchi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zchi

Go Reference

A zerolog Logger/Recoverer middleware for chi.

carbon

Install

go get -u github.com/Lavalier/zchi

Usage

package main

import (
	"net/http"

	"github.com/Lavalier/zchi"
	"github.com/go-chi/chi/v5"
	"github.com/rs/zerolog/log"
)

func main() {
	r := chi.NewRouter()
	r.Use(zchi.Logger(log.Logger))
	r.Get("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("test"))
	})
	http.ListenAndServe(":8080", r)
}