[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4741":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},4741,"zap","uber-go\u002Fzap","uber-go","Blazing fast, structured, leveled logging in Go.","https:\u002F\u002Fpkg.go.dev\u002Fgo.uber.org\u002Fzap",null,"Go",24521,1521,242,124,0,4,21,75,18,44.55,"MIT License",false,"master",[26,27,28,5],"golang","logging","structured-logging","2026-06-12 02:01:03","# :zap: zap\n\n\n\u003Cdiv align=\"center\">\n\nBlazing fast, structured, leveled logging in Go.\n\n![Zap logo](assets\u002Flogo.png)\n\n[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]\n\n\u003C\u002Fdiv>\n\n## Installation\n\n`go get -u go.uber.org\u002Fzap`\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 other structured logging\npackages and includes both structured and `printf`-style APIs.\n\n```go\nlogger, _ := zap.NewProduction()\ndefer logger.Sync() \u002F\u002F flushes buffer, if any\nsugar := logger.Sugar()\nsugar.Infow(\"failed to fetch URL\",\n  \u002F\u002F 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\nfaster than the `SugaredLogger` and allocates far less, but it only supports\nstructured logging.\n\n```go\nlogger, _ := zap.NewProduction()\ndefer logger.Sync()\nlogger.Info(\"failed to fetch URL\",\n  \u002F\u002F 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\nSee the [documentation][doc] and [FAQ](FAQ.md) for more details.\n\n## Performance\n\nFor applications that log in the hot path, reflection-based serialization and\nstring formatting are prohibitively expensive &mdash; they're CPU-intensive\nand make many small allocations. Put differently, using `encoding\u002Fjson` 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\nand allocations wherever possible. By building the high-level `SugaredLogger`\non that 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 packages &mdash; it's also faster than the\nstandard library. Like all benchmarks, take these with a grain of salt.\u003Csup\nid=\"anchor-versions\">[1](#footnote-versions)\u003C\u002Fsup>\n\nLog a message and 10 fields:\n\n| Package | Time | Time % to zap | Objects Allocated |\n| :------ | :--: | :-----------: | :---------------: |\n| :zap: zap | 656 ns\u002Fop | +0% | 5 allocs\u002Fop\n| :zap: zap (sugared) | 935 ns\u002Fop | +43% | 10 allocs\u002Fop\n| zerolog | 380 ns\u002Fop | -42% | 1 allocs\u002Fop\n| go-kit | 2249 ns\u002Fop | +243% | 57 allocs\u002Fop\n| slog (LogAttrs) | 2479 ns\u002Fop | +278% | 40 allocs\u002Fop\n| slog | 2481 ns\u002Fop | +278% | 42 allocs\u002Fop\n| apex\u002Flog | 9591 ns\u002Fop | +1362% | 63 allocs\u002Fop\n| log15 | 11393 ns\u002Fop | +1637% | 75 allocs\u002Fop\n| logrus | 11654 ns\u002Fop | +1677% | 79 allocs\u002Fop\n\nLog a message with a logger that already has 10 fields of context:\n\n| Package | Time | Time % to zap | Objects Allocated |\n| :------ | :--: | :-----------: | :---------------: |\n| :zap: zap | 67 ns\u002Fop | +0% | 0 allocs\u002Fop\n| :zap: zap (sugared) | 84 ns\u002Fop | +25% | 1 allocs\u002Fop\n| zerolog | 35 ns\u002Fop | -48% | 0 allocs\u002Fop\n| slog | 193 ns\u002Fop | +188% | 0 allocs\u002Fop\n| slog (LogAttrs) | 200 ns\u002Fop | +199% | 0 allocs\u002Fop\n| go-kit | 2460 ns\u002Fop | +3572% | 56 allocs\u002Fop\n| log15 | 9038 ns\u002Fop | +13390% | 70 allocs\u002Fop\n| apex\u002Flog | 9068 ns\u002Fop | +13434% | 53 allocs\u002Fop\n| logrus | 10521 ns\u002Fop | +15603% | 68 allocs\u002Fop\n\nLog a static string, without any context or `printf`-style templating:\n\n| Package | Time | Time % to zap | Objects Allocated |\n| :------ | :--: | :-----------: | :---------------: |\n| :zap: zap | 63 ns\u002Fop | +0% | 0 allocs\u002Fop\n| :zap: zap (sugared) | 81 ns\u002Fop | +29% | 1 allocs\u002Fop\n| zerolog | 32 ns\u002Fop | -49% | 0 allocs\u002Fop\n| standard library | 124 ns\u002Fop | +97% | 1 allocs\u002Fop\n| slog | 196 ns\u002Fop | +211% | 0 allocs\u002Fop\n| slog (LogAttrs) | 200 ns\u002Fop | +217% | 0 allocs\u002Fop\n| go-kit | 213 ns\u002Fop | +238% | 9 allocs\u002Fop\n| apex\u002Flog | 771 ns\u002Fop | +1124% | 5 allocs\u002Fop\n| logrus | 1439 ns\u002Fop | +2184% | 23 allocs\u002Fop\n| log15 | 2069 ns\u002Fop | +3184% | 20 allocs\u002Fop\n\n## Development Status: Stable\n\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\nzap to `^1`.\n\n## Contributing\n\nWe encourage and support an active, healthy community of contributors &mdash;\nincluding you! Details are in the [contribution guide](CONTRIBUTING.md) and\nthe [code of conduct](CODE_OF_CONDUCT.md). The zap maintainers keep an eye on\nissues and pull requests, but you can also report any negative conduct to\noss-conduct@uber.com. That email list is a private, safe space; even the zap\nmaintainers don't have access, so don't hesitate to hold us to a high\nstandard.\n\n\u003Chr>\n\nReleased under the [MIT License](LICENSE).\n\n\u003Csup id=\"footnote-versions\">1\u003C\u002Fsup> In particular, keep in mind that we may be\nbenchmarking against slightly older versions of other packages. Versions are\npinned in the [benchmarks\u002Fgo.mod][] file. [↩](#anchor-versions)\n\n[doc-img]: https:\u002F\u002Fpkg.go.dev\u002Fbadge\u002Fgo.uber.org\u002Fzap\n[doc]: https:\u002F\u002Fpkg.go.dev\u002Fgo.uber.org\u002Fzap\n[ci-img]: https:\u002F\u002Fgithub.com\u002Fuber-go\u002Fzap\u002Factions\u002Fworkflows\u002Fgo.yml\u002Fbadge.svg\n[ci]: https:\u002F\u002Fgithub.com\u002Fuber-go\u002Fzap\u002Factions\u002Fworkflows\u002Fgo.yml\n[cov-img]: https:\u002F\u002Fcodecov.io\u002Fgh\u002Fuber-go\u002Fzap\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg\n[cov]: https:\u002F\u002Fcodecov.io\u002Fgh\u002Fuber-go\u002Fzap\n[benchmarking suite]: https:\u002F\u002Fgithub.com\u002Fuber-go\u002Fzap\u002Ftree\u002Fmaster\u002Fbenchmarks\n[benchmarks\u002Fgo.mod]: https:\u002F\u002Fgithub.com\u002Fuber-go\u002Fzap\u002Fblob\u002Fmaster\u002Fbenchmarks\u002Fgo.mod\n\n","uber-go\u002Fzap 是一个为 Go 语言设计的高性能、结构化日志库。它提供了两种主要的日志记录器：`SugaredLogger` 和 `Logger`，前者支持结构化和 printf 风格的日志记录方式，速度比其他结构化日志包快4-10倍；后者则专注于性能与类型安全，几乎无反射且零分配，适用于对性能要求极高的场景。该项目适合需要高效处理大量日志数据的应用程序使用，特别是在日志记录处于性能关键路径时。通过 zap，开发者可以根据实际需求选择合适的方式进行日志记录，在保证应用性能的同时享受结构化日志带来的便利。",2,"2026-06-11 03:00:17","top_language"]