1- # golang-repo-template
1+ # chizap
22
3- :smile : golang-repo-template
3+ :smile : chizap
44
5- [ ![ go.dev reference] ( https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white )] ( https://pkg.go.dev/moul.io/golang-repo-template )
6- [ ![ License] ( https://img.shields.io/badge/license-Apache--2.0%20%2F%20MIT-%2397ca00.svg )] ( https://github.com/moul/golang-repo-template /blob/main/COPYRIGHT )
7- [ ![ GitHub release] ( https://img.shields.io/github/release/moul/golang-repo-template .svg )] ( https://github.com/moul/golang-repo-template /releases )
8- [ ![ Docker Metrics] ( https://images.microbadger.com/badges/image/moul/golang-repo-template .svg )] ( https://microbadger.com/images/moul/golang-repo-template )
5+ [ ![ go.dev reference] ( https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white )] ( https://pkg.go.dev/moul.io/chizap )
6+ [ ![ License] ( https://img.shields.io/badge/license-Apache--2.0%20%2F%20MIT-%2397ca00.svg )] ( https://github.com/moul/chizap /blob/main/COPYRIGHT )
7+ [ ![ GitHub release] ( https://img.shields.io/github/release/moul/chizap .svg )] ( https://github.com/moul/chizap /releases )
8+ [ ![ Docker Metrics] ( https://images.microbadger.com/badges/image/moul/chizap .svg )] ( https://microbadger.com/images/moul/chizap )
99[ ![ Made by Manfred Touron] ( https://img.shields.io/badge/made%20by-Manfred%20Touron-blue.svg?style=flat )] ( https://manfred.life/ )
1010
11- [ ![ Go] ( https://github.com/moul/golang-repo-template/workflows/Go/badge.svg )] ( https://github.com/moul/golang-repo-template/actions?query=workflow%3AGo )
12- [ ![ Release] ( https://github.com/moul/golang-repo-template/workflows/Release/badge.svg )] ( https://github.com/moul/golang-repo-template/actions?query=workflow%3ARelease )
13- [ ![ PR] ( https://github.com/moul/golang-repo-template/workflows/PR/badge.svg )] ( https://github.com/moul/golang-repo-template/actions?query=workflow%3APR )
14- [ ![ GolangCI] ( https://golangci.com/badges/github.com/moul/golang-repo-template.svg )] ( https://golangci.com/r/github.com/moul/golang-repo-template )
15- [ ![ codecov] ( https://codecov.io/gh/moul/golang-repo-template/branch/main/graph/badge.svg )] ( https://codecov.io/gh/moul/golang-repo-template )
16- [ ![ Go Report Card] ( https://goreportcard.com/badge/moul.io/golang-repo-template )] ( https://goreportcard.com/report/moul.io/golang-repo-template )
17- [ ![ CodeFactor] ( https://www.codefactor.io/repository/github/moul/golang-repo-template/badge )] ( https://www.codefactor.io/repository/github/moul/golang-repo-template )
18-
19- [ ![ Gitpod ready-to-code] ( https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod )] ( https://gitpod.io/#https://github.com/moul/golang-repo-template )
11+ [ ![ Go] ( https://github.com/moul/chizap/workflows/Go/badge.svg )] ( https://github.com/moul/chizap/actions?query=workflow%3AGo )
12+ [ ![ Release] ( https://github.com/moul/chizap/workflows/Release/badge.svg )] ( https://github.com/moul/chizap/actions?query=workflow%3ARelease )
13+ [ ![ PR] ( https://github.com/moul/chizap/workflows/PR/badge.svg )] ( https://github.com/moul/chizap/actions?query=workflow%3APR )
14+ [ ![ GolangCI] ( https://golangci.com/badges/github.com/moul/chizap.svg )] ( https://golangci.com/r/github.com/moul/chizap )
15+ [ ![ codecov] ( https://codecov.io/gh/moul/chizap/branch/main/graph/badge.svg )] ( https://codecov.io/gh/moul/chizap )
16+ [ ![ Go Report Card] ( https://goreportcard.com/badge/moul.io/chizap )] ( https://goreportcard.com/report/moul.io/chizap )
17+ [ ![ CodeFactor] ( https://www.codefactor.io/repository/github/moul/chizap/badge )] ( https://www.codefactor.io/repository/github/moul/chizap )
18+
19+ [ ![ Gitpod ready-to-code] ( https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod )] ( https://gitpod.io/#https://github.com/moul/chizap )
20+
21+ ## Example
22+
23+ [ embedmd ] :# ( example_test.go /import\ / $ )
24+ ``` go
25+ import (
26+ " github.com/go-chi/chi"
27+ " go.uber.org/zap"
28+ " moul.io/chizap"
29+ )
30+
31+ func Example () {
32+ logger := zap.NewExample ()
33+ r := chi.NewRouter ()
34+ r.Use (chizap.New (logger, &chizap.Opts {
35+ WithReferer: true ,
36+ WithUserAgent: true ,
37+ }))
38+ }
39+ ```
2040
2141## Usage
2242
23- [ embedmd ] :# ( .tmp/usage.txt console )
24- ``` console
25- foo@bar:~ $ golang-repo-template hello world
26- _ _ _ _
27- __ _ ___ | | __ _ _ _ __ _ ___ _ _ ___ _ __ ___ ___ | |_ ___ _ __ _ __ | | __ _ | |_ ___
28- / _` |/ _ \| |/ _` || ' \ / _` ||___|| '_|/ -_)| '_ \/ _ \|___|| _|/ -_)| ' \ | '_ \| |/ _` || _|/ -_)
29- \__, |\___/|_|\__,_||_||_|\__, | |_| \___|| .__/\___/ \__|\___||_|_|_|| .__/|_|\__,_| \__|\___|
30- |___/ |___/ |_| |_|
31- 12 CPUs, /home/moul/.gvm/pkgsets/go1.16/global/bin/golang-repo-template, fwrz, go1.16
32- args ["golang-repo-template","hello","world"]
43+ [ embedmd ] :# ( .tmp/godoc.txt txt /FUNCTIONS/ $ )
44+ ``` txt
45+ FUNCTIONS
46+
47+ func New(logger *zap.Logger, opts *Opts) func(next http.Handler) http.Handler
48+ New returns a logger middleware for chi, that implements the http.Handler
49+ interface.
50+
51+
52+ TYPES
53+
54+ type Opts struct {
55+ // WithReferer enables logging the "Referer" HTTP header value.
56+ WithReferer bool
57+
58+ // WithUserAgent enables logging the "User-Agent" HTTP header value.
59+ WithUserAgent bool
60+ }
61+ Opts contains the middleware configuration.
62+
3363```
3464
3565## Install
3666
3767### Using go
3868
3969``` sh
40- go get moul.io/golang-repo-template
70+ go get moul.io/chizap
4171```
4272
4373### Releases
4474
45- See https://github.com/moul/golang-repo-template /releases
75+ See https://github.com/moul/chizap /releases
4676
4777## Contribute
4878
@@ -73,7 +103,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
73103<!-- markdownlint-disable -->
74104<table >
75105 <tr >
76- <td align="center"><a href="http://manfred.life"><img src="https://avatars1.githubusercontent.com/u/94029?v=4" width="100px;" alt=""/><br /><sub><b>Manfred Touron</b></sub></a><br /><a href="#maintenance-moul" title="Maintenance">🚧</a> <a href="https://github.com/moul/golang-repo-template /commits?author=moul" title="Documentation">📖</a> <a href="https://github.com/moul/golang-repo-template /commits?author=moul" title="Tests">⚠️</a> <a href="https://github.com/moul/golang-repo-template /commits?author=moul" title="Code">💻</a></td>
106+ <td align="center"><a href="http://manfred.life"><img src="https://avatars1.githubusercontent.com/u/94029?v=4" width="100px;" alt=""/><br /><sub><b>Manfred Touron</b></sub></a><br /><a href="#maintenance-moul" title="Maintenance">🚧</a> <a href="https://github.com/moul/chizap /commits?author=moul" title="Documentation">📖</a> <a href="https://github.com/moul/chizap /commits?author=moul" title="Tests">⚠️</a> <a href="https://github.com/moul/chizap /commits?author=moul" title="Code">💻</a></td>
77107 <td align="center"><a href="https://manfred.life/moul-bot"><img src="https://avatars1.githubusercontent.com/u/41326314?v=4" width="100px;" alt=""/><br /><sub><b>moul-bot</b></sub></a><br /><a href="#maintenance-moul-bot" title="Maintenance">🚧</a></td>
78108 </tr >
79109</table >
@@ -87,7 +117,7 @@ specification. Contributions of any kind welcome!
87117
88118### Stargazers over time
89119
90- [ ![ Stargazers over time] ( https://starchart.cc/moul/golang-repo-template .svg )] ( https://starchart.cc/moul/golang-repo-template )
120+ [ ![ Stargazers over time] ( https://starchart.cc/moul/chizap .svg )] ( https://starchart.cc/moul/chizap )
91121
92122## License
93123
0 commit comments