{"id":37207521,"url":"https://github.com/rs/zap","last_synced_at":"2026-01-14T23:51:58.981Z","repository":{"id":57504607,"uuid":"91823481","full_name":"rs/zap","owner":"rs","description":"Blazing fast, structured, leveled logging in Go.","archived":false,"fork":true,"pushed_at":"2017-07-26T07:49:45.000Z","size":800,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T15:52:58.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://godoc.org/go.uber.org/zap","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"uber-go/zap","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-19T16:08:25.000Z","updated_at":"2017-05-19T16:08:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rs/zap","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/rs/zap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fzap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fzap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fzap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fzap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rs","download_url":"https://codeload.github.com/rs/zap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fzap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28439566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"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":[],"created_at":"2026-01-14T23:51:58.302Z","updated_at":"2026-01-14T23:51:58.967Z","avatar_url":"https://github.com/rs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]\n\nBlazing fast, structured, leveled logging in Go.\n\n## Installation\n\n`go get -u go.uber.org/zap`\n\nNote that zap only supports the two most recent minor versions of Go.\n\n## Quick Start\n\nIn contexts where performance is nice, but not critical, use the\n`SugaredLogger`. It's 4-10x faster than than other structured logging libraries\nand includes both structured and `printf`-style APIs.\n\n```go\nlogger, _ := zap.NewProduction()\ndefer logger.Sync() // flushes buffer, if any\nsugar := logger.Sugar()\nsugar.Infow(\"Failed to fetch URL.\",\n  // Structured context as loosely-typed key-value pairs.\n  \"url\", url,\n  \"attempt\", 3,\n  \"backoff\", time.Second,\n)\nsugar.Infof(\"Failed to fetch URL: %s\", url)\n```\n\nWhen performance and type safety are critical, use the `Logger`. It's even faster than\nthe `SugaredLogger` and allocates far less, but it only supports structured logging.\n\n```go\nlogger, _ := zap.NewProduction()\ndefer logger.Sync()\nlogger.Info(\"Failed to fetch URL.\",\n  // Structured context as strongly-typed Field values.\n  zap.String(\"url\", url),\n  zap.Int(\"attempt\", 3),\n  zap.Duration(\"backoff\", time.Second),\n)\n```\n\n## Performance\n\nFor applications that log in the hot path, reflection-based serialization and\nstring formatting are prohibitively expensive \u0026mdash; they're CPU-intensive and\nmake many small allocations. Put differently, using `encoding/json` and\n`fmt.Fprintf` to log tons of `interface{}`s makes your application slow.\n\nZap takes a different approach. It includes a reflection-free, zero-allocation\nJSON encoder, and the base `Logger` strives to avoid serialization overhead and\nallocations wherever possible. By building the high-level `SugaredLogger` on\nthat foundation, zap lets users *choose* when they need to count every\nallocation and when they'd prefer a more familiar, loosely-typed API.\n\nAs measured by its own [benchmarking suite][], not only is zap more performant\nthan comparable structured logging libraries \u0026mdash; it's also faster than the\nstandard library. Like all benchmarks, take these with a grain of salt.\u003csup\nid=\"anchor-versions\"\u003e[1](#footnote-versions)\u003c/sup\u003e\n\nLog a message and 10 fields:\n\n| Library | Time | Bytes Allocated | Objects Allocated |\n| :--- | :---: | :---: | :---: |\n| :zap: zap | 1526 ns/op | 704 B/op | 2 allocs/op |\n| :zap: zap (sugared) | 2274 ns/op | 1610 B/op | 20 allocs/op |\n| go-kit | 5854 ns/op | 2895 B/op | 66 allocs/op |\n| logrus | 9117 ns/op | 6092 B/op | 78 allocs/op |\n| lion | 9408 ns/op | 5807 B/op | 63 allocs/op |\n| apex/log | 17007 ns/op | 3832 B/op | 65 allocs/op |\n| log15 | 21290 ns/op | 5632 B/op | 93 allocs/op |\n\nLog a message with a logger that already has 10 fields of context:\n\n| Library | Time | Bytes Allocated | Objects Allocated |\n| :--- | :---: | :---: | :---: |\n| :zap: zap | 446 ns/op | 0 B/op | 0 allocs/op |\n| :zap: zap (sugared) | 599 ns/op | 80 B/op | 2 allocs/op |\n| lion | 5231 ns/op | 4074 B/op | 38 allocs/op |\n| go-kit | 6424 ns/op | 3046 B/op | 52 allocs/op |\n| logrus | 7578 ns/op | 4564 B/op | 63 allocs/op |\n| apex/log | 15697 ns/op | 2898 B/op | 51 allocs/op |\n| log15 | 15879 ns/op | 2642 B/op | 44 allocs/op |\n\nLog a static string, without any context or `printf`-style templating:\n\n| Library | Time | Bytes Allocated | Objects Allocated |\n| :--- | :---: | :---: | :---: |\n| :zap: zap | 418 ns/op | 0 B/op | 0 allocs/op |\n| standard library | 524 ns/op | 80 B/op | 2 allocs/op |\n| :zap: zap (sugared) | 628 ns/op | 80 B/op | 2 allocs/op |\n| go-kit | 1011 ns/op | 656 B/op | 13 allocs/op |\n| lion | 1382 ns/op | 1224 B/op | 10 allocs/op |\n| logrus | 2263 ns/op | 1505 B/op | 27 allocs/op |\n| apex/log | 3198 ns/op | 584 B/op | 11 allocs/op |\n| log15 | 5787 ns/op | 1592 B/op | 26 allocs/op |\n\n## Development Status: Stable\nAll APIs are finalized, and no breaking changes will be made in the 1.x series\nof releases. Users of semver-aware dependency management systems should pin zap\nto `^1`.\n\n\u003chr\u003e\n\nReleased under the [MIT License](LICENSE.txt).\n\n\u003csup id=\"footnote-versions\"\u003e1\u003c/sup\u003e In particular, keep in mind that we may be\nbenchmarking against slightly older versions of other libraries. Versions are\npinned in zap's [glide.lock][] file. [↩](#anchor-versions)\n\n[doc-img]: https://godoc.org/go.uber.org/zap?status.svg\n[doc]: https://godoc.org/go.uber.org/zap\n[ci-img]: https://travis-ci.org/uber-go/zap.svg?branch=master\n[ci]: https://travis-ci.org/uber-go/zap\n[cov-img]: https://coveralls.io/repos/github/uber-go/zap/badge.svg?branch=master\n[cov]: https://coveralls.io/github/uber-go/zap?branch=master\n[benchmarking suite]: https://github.com/uber-go/zap/tree/master/benchmarks\n[glide.lock]: https://github.com/uber-go/zap/blob/master/glide.lock\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frs%2Fzap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frs%2Fzap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frs%2Fzap/lists"}