{"id":18831285,"url":"https://github.com/acrazing/ctxzap","last_synced_at":"2026-04-28T21:32:41.423Z","repository":{"id":204917308,"uuid":"712879299","full_name":"acrazing/ctxzap","owner":"acrazing","description":"Bind zap to context, built-in support for grpc.","archived":false,"fork":false,"pushed_at":"2023-11-02T01:07:00.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"production","last_synced_at":"2025-05-29T16:19:02.181Z","etag":null,"topics":["context","grpc","logging","zap"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/acrazing/ctxzap","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/acrazing.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,"governance":null}},"created_at":"2023-11-01T11:48:30.000Z","updated_at":"2023-11-02T01:13:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc8f7a6e-f677-450b-95e0-59bac658ec81","html_url":"https://github.com/acrazing/ctxzap","commit_stats":null,"previous_names":["moegolibrary/ctxzap","acrazing/ctxzap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/acrazing/ctxzap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acrazing%2Fctxzap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acrazing%2Fctxzap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acrazing%2Fctxzap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acrazing%2Fctxzap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acrazing","download_url":"https://codeload.github.com/acrazing/ctxzap/tar.gz/refs/heads/production","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acrazing%2Fctxzap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32400861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"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":["context","grpc","logging","zap"],"created_at":"2024-11-08T01:52:52.138Z","updated_at":"2026-04-28T21:32:41.377Z","avatar_url":"https://github.com/acrazing.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ctxzap\n\nBind zap to context, built-in support for grpc.\n\n## Install\n\n   ```bash\n   go get github.com/acrazing/ctxzap\n   ```\n\n## Quick start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"github.com/acrazing/ctxzap\"\n    \"github.com/acrazing/ctxzap/grpc_zap\"\n    \"go.uber.org/zap\"\n    \"google.golang.org/grpc\"\n)\n\nfunc main() {\n\t// get your logger\n    logger := zap.NewExample()\n\n\t// inject interceptors\n    _ = grpc.NewServer(\n        grpc.ChainUnaryInterceptor(\n            grpc_zap.UnaryServerInterceptor(logger, grpc_zap.WithAccessLog(true, true)),\n        ),\n        grpc.ChainStreamInterceptor(\n            grpc_zap.StreamServerInterceptor(logger, grpc_zap.WithEventLog(true, true)),\n        ),\n    )\n\n\t// print log\n    // In any context based method called by grpc servers\n    _ = func(ctx context.Context) {\n        // add a field to the context, this field will always be printed in the next\n        // log calls with the context.\n        ctxzap.AddFields(ctx, zap.String(\"data\", \"1\"))\n\n        // replace an existing field or append it to the context\n        ctxzap.ReplaceField(ctx, zap.String(\"data\", \"2\"))\n\n        // print a log\n        ctxzap.Info(ctx, \"call with data\", zap.String(\"value\", \"2\"))\n    }\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facrazing%2Fctxzap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facrazing%2Fctxzap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facrazing%2Fctxzap/lists"}