{"id":40296675,"url":"https://github.com/purini-to/zapmw","last_synced_at":"2026-01-20T05:06:38.623Z","repository":{"id":57521845,"uuid":"188166601","full_name":"purini-to/zapmw","owner":"purini-to","description":"zapmw is \"net/http.Handler\" logging middleware using zap.","archived":false,"fork":false,"pushed_at":"2019-07-11T04:05:41.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-27T22:29:58.379Z","etag":null,"topics":["go","golang","logger","logging","zap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/purini-to.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-23T05:22:45.000Z","updated_at":"2019-07-11T04:04:47.000Z","dependencies_parsed_at":"2022-08-26T20:23:58.219Z","dependency_job_id":null,"html_url":"https://github.com/purini-to/zapmw","commit_stats":null,"previous_names":[],"tags_count":3,"template":null,"template_full_name":null,"purl":"pkg:github/purini-to/zapmw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purini-to%2Fzapmw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purini-to%2Fzapmw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purini-to%2Fzapmw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purini-to%2Fzapmw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purini-to","download_url":"https://codeload.github.com/purini-to/zapmw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purini-to%2Fzapmw/sbom","scorecard":{"id":750031,"data":{"date":"2025-08-11","repo":{"name":"github.com/purini-to/zapmw","commit":"3a72db53d5894d700c8a9cde5b21aecb9073c20d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T20:02:38.372Z","repository_id":57521845,"created_at":"2025-08-22T20:02:38.372Z","updated_at":"2025-08-22T20:02:38.372Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28596087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","logger","logging","zap"],"created_at":"2026-01-20T05:06:37.853Z","updated_at":"2026-01-20T05:06:38.618Z","avatar_url":"https://github.com/purini-to.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zapmw\n\n[![CircleCI](https://circleci.com/gh/purini-to/zapmw/tree/master.svg?style=svg)](https://circleci.com/gh/purini-to/zapmw/tree/master)\n[![codecov](https://codecov.io/gh/purini-to/zapmw/branch/master/graph/badge.svg)](https://codecov.io/gh/purini-to/zapmw)\n\nzapmw is `net/http.Handler` middleware using [zap](https://github.com/uber-go/zap).  \n\n## Installation\n\n`go get -u github.com/purini-to/zapmw`\n\n## Quick Start\n\nIt can be used as middleware on compatible routers due to the net/http.Handler interface.\n\nrouter http.NewServeMux:\n```go\npackage main\n\nimport (\n\t\"github.com/purini-to/zapmw\"\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n\t\"net/http\"\n)\n\nvar cnt = 1\n\nfunc main() {\n\tlogger, _ := zap.NewDevelopment()\n\n\tm := http.NewServeMux()\n\tm.Handle(\"/\",\n\t\tzapmw.WithZap(logger)(zapmw.Request(zapcore.InfoLevel, \"request\")(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tlogger := zapmw.GetZap(r)\n\t\t\tlogger.Debug(\"access!\", zap.Int(\"cnt\", cnt))\n\t\t\tw.Write([]byte(\"Hello world\"))\n\t\t\tcnt++\n\t\t}))),\n\t)\n\n\ts := http.Server{Addr: \":3000\", Handler: m}\n\ts.ListenAndServe()\n}\n// out:\n// 2019-05-23T14:00:15.410+0900\tDEBUG\tcmd/main.go:19\taccess!\t{\"cnt\": 1}\n// 2019-05-23T14:00:15.410+0900\tINFO\tzapmw/request.go:32\trequest\t{\"method\": \"GET\", \"url\": \"/\", \"proto\": \"HTTP/1.1\", \"status\": 200, \"ip\": \"[::1]:54434\", \"byte\": 11, \"took\": \"440.597µs\"}\n// 2019-05-23T14:00:15.917+0900\tDEBUG\tcmd/main.go:19\taccess!\t{\"cnt\": 2}\n// 2019-05-23T14:00:15.917+0900\tINFO\tzapmw/request.go:32\trequest\t{\"method\": \"GET\", \"url\": \"/\", \"proto\": \"HTTP/1.1\", \"status\": 200, \"ip\": \"[::1]:54434\", \"byte\": 11, \"took\": \"86.27µs\"}\n```\n\nrouter [chi](https://github.com/go-chi/chi):\n```go\npackage main\n\nimport (\n\t\"github.com/go-chi/chi\"\n\t\"github.com/go-chi/chi/middleware\"\n\t\"github.com/purini-to/zapmw\"\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n\t\"net/http\"\n)\n\nvar cnt = 1\n\nfunc withRequestID(logger *zap.Logger, r *http.Request) *zap.Logger {\n\treqID := middleware.GetReqID(r.Context())\n\tif len(reqID) == 0 {\n\t\treturn logger\n\t}\n\n\treturn logger.With(zap.String(\"reqId\", reqID))\n}\n\nfunc main() {\n\tlogger, _ := zap.NewDevelopment()\n\n\tr := chi.NewRouter()\n\n\tr.Use(\n\t\tmiddleware.RequestID,\n\t\tzapmw.WithZap(logger, withRequestID), // logger with request id.\n\t\tzapmw.Request(zapcore.InfoLevel, \"request\"),\n\t\tzapmw.Recoverer(zapcore.ErrorLevel, \"recover\", zapmw.RecovererDefault),\n\t)\n\n\tr.Get(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger := zapmw.GetZap(r)\n\t\tlogger.Debug(\"access!\", zap.Int(\"cnt\", cnt))\n\t\tw.Write([]byte(\"Hello world\"))\n\t\tcnt++\n\t})\n\n\thttp.ListenAndServe(\":3000\", r)\n}\n// out:\n// 2019-05-23T14:11:38.650+0900\tDEBUG\tchi/main.go:37\taccess!\t{\"reqId\": \"xxxxxx-000001\", \"cnt\": 1}\n// 2019-05-23T14:11:38.650+0900\tINFO\tzapmw/request.go:32\trequest\t{\"reqId\": \"xxxxxx-000001\", \"method\": \"GET\", \"url\": \"/\", \"proto\": \"HTTP/1.1\", \"status\": 200, \"ip\": \"[::1]:54517\", \"byte\": 11, \"took\": \"174.504µs\"}\n// 2019-05-23T14:11:39.442+0900\tDEBUG\tchi/main.go:37\taccess!\t{\"reqId\": \"xxxxxx-000002\", \"cnt\": 2}\n// 2019-05-23T14:11:39.442+0900\tINFO\tzapmw/request.go:32\trequest\t{\"reqId\": \"xxxxxx-000002\", \"method\": \"GET\", \"url\": \"/\", \"proto\": \"HTTP/1.1\", \"status\": 200, \"ip\": \"[::1]:54517\", \"byte\": 11, \"took\": \"55.185µs\"}\n```\n\nrouter [gorilla/mux](https://github.com/gorilla/mux):\n```go\npackage main\n\nimport (\n\t\"github.com/gorilla/mux\"\n\t\"github.com/purini-to/zapmw\"\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n\t\"net/http\"\n)\n\nvar cnt = 1\n\nfunc main() {\n\tlogger, _ := zap.NewDevelopment()\n\n\tr := mux.NewRouter()\n\n\tr.Use(\n\t\tzapmw.WithZap(logger),\n\t\tzapmw.Request(zapcore.InfoLevel, \"request\"),\n\t\tzapmw.Recoverer(zapcore.ErrorLevel, \"recover\", zapmw.RecovererDefault),\n\t)\n\n\tr.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger := zapmw.GetZap(r)\n\t\tlogger.Debug(\"access!\", zap.Int(\"cnt\", cnt))\n\t\tw.Write([]byte(\"Hello world\"))\n\t\tcnt++\n\t})\n\n\thttp.ListenAndServe(\":3000\", r)\n}\n// out:\n// 2019-05-23T14:18:35.966+0900\tDEBUG\tgorilla/main.go:26\taccess!\t{\"cnt\": 1}\n// 2019-05-23T14:18:35.966+0900\tINFO\tzapmw/request.go:32\trequest\t{\"method\": \"GET\", \"url\": \"/\", \"proto\": \"HTTP/1.1\", \"status\": 200, \"ip\": \"[::1]:54563\", \"byte\": 11, \"took\": \"426.231µs\"}\n// 2019-05-23T14:18:36.588+0900\tDEBUG\tgorilla/main.go:26\taccess!\t{\"cnt\": 2}\n// 2019-05-23T14:18:36.588+0900\tINFO\tzapmw/request.go:32\trequest\t{\"method\": \"GET\", \"url\": \"/\", \"proto\": \"HTTP/1.1\", \"status\": 200, \"ip\": \"[::1]:54563\", \"byte\": 11, \"took\": \"84.474µs\"}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurini-to%2Fzapmw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurini-to%2Fzapmw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurini-to%2Fzapmw/lists"}