Renovate
ec981ac676
ci/woodpecker/push/test Pipeline was successful
Details
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/stretchr/testify](https://github.com/stretchr/testify) | require | minor | `v1.8.4` -> `v1.9.0` | --- ### Release Notes <details> <summary>stretchr/testify (github.com/stretchr/testify)</summary> ### [`v1.9.0`](https://github.com/stretchr/testify/releases/tag/v1.9.0) [Compare Source](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) #### What's Changed - Fix Go modules version by [@​SuperQ](https://github.com/SuperQ) in https://github.com/stretchr/testify/pull/1394 - Document that require is not safe to call in created goroutines by [@​programmer04](https://github.com/programmer04) in https://github.com/stretchr/testify/pull/1392 - Remove myself from MAINTAINERS.md by [@​mvdkleijn](https://github.com/mvdkleijn) in https://github.com/stretchr/testify/pull/1367 - Correct spelling/grammar by [@​echarrod](https://github.com/echarrod) in https://github.com/stretchr/testify/pull/1389 - docs: Update URLs in README by [@​davidjb](https://github.com/davidjb) in https://github.com/stretchr/testify/pull/1349 - Update mockery link to Github Pages in README by [@​LandonTClipp](https://github.com/LandonTClipp) in https://github.com/stretchr/testify/pull/1346 - docs: Fix typos in tests and comments by [@​alexandear](https://github.com/alexandear) in https://github.com/stretchr/testify/pull/1410 - CI: tests from go1.17 by [@​SuperQ](https://github.com/SuperQ) in https://github.com/stretchr/testify/pull/1409 - Fix adding ? when no values passed by [@​lesichkovm](https://github.com/lesichkovm) in https://github.com/stretchr/testify/pull/1320 - codegen: use standard header for generated files by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1406 - mock: AssertExpectations log reason only on failure by [@​hikyaru-suzuki](https://github.com/hikyaru-suzuki) in https://github.com/stretchr/testify/pull/1360 - assert: fix flaky TestNeverTrue by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1417 - README: fix typos "set up" vs "setup" by [@​ossan-dev](https://github.com/ossan-dev) in https://github.com/stretchr/testify/pull/1428 - mock: move regexp compilation outside of `Called` by [@​aud10slave](https://github.com/aud10slave) in https://github.com/stretchr/testify/pull/631 - assert: refactor internal func getLen() by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1445 - mock: deprecate type AnythingOfTypeArgument ([#​1434](https://github.com/stretchr/testify/issues/1434)) by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1441 - Remove no longer needed assert.canConvert by [@​alexandear](https://github.com/alexandear) in https://github.com/stretchr/testify/pull/1470 - assert: ObjectsAreEqual: use time.Equal for time.Time types by [@​tscales](https://github.com/tscales) in https://github.com/stretchr/testify/pull/1464 - Bump actions/checkout from 3 to 4 by [@​dependabot](https://github.com/dependabot) in https://github.com/stretchr/testify/pull/1466 - Bump actions/setup-go from 3.2.0 to 4.1.0 by [@​dependabot](https://github.com/dependabot) in https://github.com/stretchr/testify/pull/1451 - fix: make EventuallyWithT concurrency safe by [@​czeslavo](https://github.com/czeslavo) in https://github.com/stretchr/testify/pull/1395 - assert: fix httpCode and HTTPBody occur panic when http.Handler read Body by [@​hidu](https://github.com/hidu) in https://github.com/stretchr/testify/pull/1484 - assert.EqualExportedValues: fix handling of arrays by [@​zrbecker](https://github.com/zrbecker) in https://github.com/stretchr/testify/pull/1473 - .github: use latest Go versions by [@​kevinburkesegment](https://github.com/kevinburkesegment) in https://github.com/stretchr/testify/pull/1489 - assert: Deprecate EqualExportedValues by [@​HaraldNordgren](https://github.com/HaraldNordgren) in https://github.com/stretchr/testify/pull/1488 - suite: refactor test assertions by [@​alexandear](https://github.com/alexandear) in https://github.com/stretchr/testify/pull/1474 - suite: fix SetupSubTest and TearDownSubTest execution order by [@​linusbarth](https://github.com/linusbarth) in https://github.com/stretchr/testify/pull/1471 - docs: Fix deprecation comments for http package by [@​alexandear](https://github.com/alexandear) in https://github.com/stretchr/testify/pull/1335 - Add map support doc comments to Subset and NotSubset by [@​jedevc](https://github.com/jedevc) in https://github.com/stretchr/testify/pull/1306 - TestErrorIs/TestNotErrorIs: check error message contents by [@​craig65535](https://github.com/craig65535) in https://github.com/stretchr/testify/pull/1435 - suite: fix subtest names (fix [#​1501](https://github.com/stretchr/testify/issues/1501)) by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1504 - assert: improve unsafe.Pointer tests by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1505 - assert: simplify isNil implementation by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1506 - assert.InEpsilonSlice: fix expected/actual order and other improvements by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1483 - Fix dependency cycle with objx [#​1292](https://github.com/stretchr/testify/issues/1292) by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1453 - mock: refactor TestIsArgsEqual by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1444 - mock: optimize argument matching checks by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1416 - assert: fix TestEventuallyTimeout by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1412 - CI: add go 1.21 in GitHub Actions by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1450 - suite: fix recoverAndFailOnPanic to report test failure at the right location by [@​dolmen](https://github.com/dolmen) in https://github.com/stretchr/testify/pull/1502 - Update maintainers by [@​brackendawson](https://github.com/brackendawson) in https://github.com/stretchr/testify/pull/1533 - assert: Fix EqualValues to handle overflow/underflow by [@​arjunmahishi](https://github.com/arjunmahishi) in https://github.com/stretchr/testify/pull/1531 - assert: better formatting for Len() error by [@​kevinburkesegment](https://github.com/kevinburkesegment) in https://github.com/stretchr/testify/pull/1485 - Ensure AssertExpectations does not fail in skipped tests by [@​ianrose14](https://github.com/ianrose14) in https://github.com/stretchr/testify/pull/1331 - suite: fix deadlock in suite.Require()/Assert() by [@​arjunmahishi](https://github.com/arjunmahishi) in https://github.com/stretchr/testify/pull/1535 - Revert "assert: ObjectsAreEqual: use time.Equal for time.Time type" by [@​brackendawson](https://github.com/brackendawson) in https://github.com/stretchr/testify/pull/1537 - \[chore] Add issue templates by [@​arjunmahishi](https://github.com/arjunmahishi) in https://github.com/stretchr/testify/pull/1538 - Update the build status badge by [@​brackendawson](https://github.com/brackendawson) in https://github.com/stretchr/testify/pull/1540 - Update Github workflows setup-go to V5 by [@​hendrywiranto](https://github.com/hendrywiranto) in https://github.com/stretchr/testify/pull/1545 - Support Pointer to Struct in EqualExportedValues by [@​Lucaber](https://github.com/Lucaber) in https://github.com/stretchr/testify/pull/1517 - README: drop link to gorc by [@​guettli](https://github.com/guettli) in https://github.com/stretchr/testify/pull/1248 - http_assertions: honour the msgAndArgs provided with each assertion by [@​arjunmahishi](https://github.com/arjunmahishi) in https://github.com/stretchr/testify/pull/1548 - fix typos in comments and tests by [@​ccoVeille](https://github.com/ccoVeille) in https://github.com/stretchr/testify/pull/1247 - Include the auto-release notes in releases by [@​brackendawson](https://github.com/brackendawson) in https://github.com/stretchr/testify/pull/1550 - Add `NotImplements` and variants by [@​hslatman](https://github.com/hslatman) in https://github.com/stretchr/testify/pull/1385 - Add support to compare uintptr by [@​bogdandrutu](https://github.com/bogdandrutu) in https://github.com/stretchr/testify/pull/1339 - build(deps): bump github.com/stretchr/objx from 0.5.1 to 0.5.2 by [@​dependabot](https://github.com/dependabot) in https://github.com/stretchr/testify/pull/1552 #### New Contributors - [@​SuperQ](https://github.com/SuperQ) made their first contribution in https://github.com/stretchr/testify/pull/1394 - [@​programmer04](https://github.com/programmer04) made their first contribution in https://github.com/stretchr/testify/pull/1392 - [@​echarrod](https://github.com/echarrod) made their first contribution in https://github.com/stretchr/testify/pull/1389 - [@​davidjb](https://github.com/davidjb) made their first contribution in https://github.com/stretchr/testify/pull/1349 - [@​LandonTClipp](https://github.com/LandonTClipp) made their first contribution in https://github.com/stretchr/testify/pull/1346 - [@​alexandear](https://github.com/alexandear) made their first contribution in https://github.com/stretchr/testify/pull/1410 - [@​lesichkovm](https://github.com/lesichkovm) made their first contribution in https://github.com/stretchr/testify/pull/1320 - [@​dolmen](https://github.com/dolmen) made their first contribution in https://github.com/stretchr/testify/pull/1406 - [@​hikyaru-suzuki](https://github.com/hikyaru-suzuki) made their first contribution in https://github.com/stretchr/testify/pull/1360 - [@​ossan-dev](https://github.com/ossan-dev) made their first contribution in https://github.com/stretchr/testify/pull/1428 - [@​aud10slave](https://github.com/aud10slave) made their first contribution in https://github.com/stretchr/testify/pull/631 - [@​tscales](https://github.com/tscales) made their first contribution in https://github.com/stretchr/testify/pull/1464 - [@​czeslavo](https://github.com/czeslavo) made their first contribution in https://github.com/stretchr/testify/pull/1395 - [@​hidu](https://github.com/hidu) made their first contribution in https://github.com/stretchr/testify/pull/1484 - [@​zrbecker](https://github.com/zrbecker) made their first contribution in https://github.com/stretchr/testify/pull/1473 - [@​kevinburkesegment](https://github.com/kevinburkesegment) made their first contribution in https://github.com/stretchr/testify/pull/1489 - [@​linusbarth](https://github.com/linusbarth) made their first contribution in https://github.com/stretchr/testify/pull/1471 - [@​jedevc](https://github.com/jedevc) made their first contribution in https://github.com/stretchr/testify/pull/1306 - [@​craig65535](https://github.com/craig65535) made their first contribution in https://github.com/stretchr/testify/pull/1435 - [@​arjunmahishi](https://github.com/arjunmahishi) made their first contribution in https://github.com/stretchr/testify/pull/1531 - [@​ianrose14](https://github.com/ianrose14) made their first contribution in https://github.com/stretchr/testify/pull/1331 - [@​hendrywiranto](https://github.com/hendrywiranto) made their first contribution in https://github.com/stretchr/testify/pull/1545 - [@​Lucaber](https://github.com/Lucaber) made their first contribution in https://github.com/stretchr/testify/pull/1517 - [@​guettli](https://github.com/guettli) made their first contribution in https://github.com/stretchr/testify/pull/1248 - [@​ccoVeille](https://github.com/ccoVeille) made their first contribution in https://github.com/stretchr/testify/pull/1247 - [@​hslatman](https://github.com/hslatman) made their first contribution in https://github.com/stretchr/testify/pull/1385 - [@​bogdandrutu](https://github.com/bogdandrutu) made their first contribution in https://github.com/stretchr/testify/pull/1339 **Full Changelog**: https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=--> Reviewed-on: #25 Co-authored-by: Renovate <renovate@dwysokinski.me> Co-committed-by: Renovate <renovate@dwysokinski.me> |
||
---|---|---|
.woodpecker | ||
.gitignore | ||
.golangci.yml | ||
LICENSE | ||
README.md | ||
config.go | ||
go.mod | ||
go.sum | ||
logger.go | ||
logger_test.go | ||
renovate.json |
README.md
chizap
A request logging middleware for go-chi using zap.
Getting started
Installation
go get gitea.dwysokinski.me/Kichiyaki/chizap
Usage
package main
import (
"log"
"net/http"
"strings"
"gitea.dwysokinski.me/Kichiyaki/chizap"
"github.com/go-chi/chi/v5"
"go.uber.org/zap"
)
func main() {
logger, err := zap.NewDevelopment()
if err != nil {
log.Fatalln("zap.NewDevelopment", err)
}
http.ListenAndServe(":8080", newRouter(logger))
}
func newRouter(logger *zap.Logger) *chi.Mux {
router := chi.NewRouter()
router.Route("/", func(r chi.Router) {
r.Use(chizap.Logger(
logger,
chizap.WithFilter(func(r *http.Request) bool {
return r.URL.Path != "/excluded"
}),
chizap.WithFilter(func(r *http.Request) bool {
return r.URL.Path != "/excluded2"
}),
chizap.WithAdditionalFieldExtractor(func(r *http.Request) []zap.Field {
if !strings.HasPrefix(r.URL.Path, "/delete") {
return nil
}
return []zap.Field{
zap.String("id", chi.URLParam(r, "id")),
}
}),
))
r.Get("/info", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
r.Get("/warn", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusBadRequest)
})
r.Get("/error", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
})
r.Get("/excluded", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
r.Delete("/delete/{id}", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
})
return router
}
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Dawid Wysokiński - contact@dwysokinski.me