{"id":47603573,"url":"https://github.com/banditmoscow1337/bark","last_synced_at":"2026-04-01T19:00:01.193Z","repository":{"id":337804511,"uuid":"1155227919","full_name":"banditmoscow1337/bark","owner":"banditmoscow1337","description":"Blazingly fast, zero-allocation structured logging library for Go","archived":false,"fork":false,"pushed_at":"2026-02-11T11:07:58.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-11T19:38:12.695Z","etag":null,"topics":["backend","binary-protocol","go","golang","high-performance","json-logging","logging","low-latency","performance","structrual-logging","zero-allocation"],"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/banditmoscow1337.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-11T09:18:02.000Z","updated_at":"2026-02-11T11:08:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/banditmoscow1337/bark","commit_stats":null,"previous_names":["banditmoscow1337/bark"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/banditmoscow1337/bark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banditmoscow1337%2Fbark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banditmoscow1337%2Fbark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banditmoscow1337%2Fbark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banditmoscow1337%2Fbark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/banditmoscow1337","download_url":"https://codeload.github.com/banditmoscow1337/bark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banditmoscow1337%2Fbark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"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":["backend","binary-protocol","go","golang","high-performance","json-logging","logging","low-latency","performance","structrual-logging","zero-allocation"],"created_at":"2026-04-01T18:59:59.707Z","updated_at":"2026-04-01T19:00:01.172Z","avatar_url":"https://github.com/banditmoscow1337.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bark\n\n**bark** is a blazingly fast, zero-allocation structured logging library for Go. Designed for high-throughput systems and low-latency environments, it provides both a traditional JSON output and a specialized binary format for maximum efficiency.\n\n## Features\n\n-   **Zero Allocations**: Leverages `sync.Pool` and pre-allocated buffers to ensure no heap allocations occur during the logging hot path.\n    \n-   **Dual Format Support**:\n    \n    -   **JSON**: Human-readable and industry-standard structured logs.\n        \n    -   **Binary**: A compact, tagged binary protocol for extreme performance and reduced I/O bandwidth.\n        \n-   **Architectural Optimizations**:\n    \n    -   **Custom Time Formatting**: Bypasses `time.Format` to avoid layout string parsing overhead.\n        \n    -   **Optimized Escaping**: Custom JSON string escaping implementation.\n        \n    -   **Minimal Dependencies**: Only relies on the Go standard library.\n        \n-   **Rich Type Support**: Chainable API supporting `Int`, `Uint`, `Float`, `Complex`, `Bool`, `Bytes`, `Error`, and `Str`.\n    \n\n## Benchmarks\n\nResults obtained on an **Apple M1 (arm64)**. Both loggers achieve **0 B/op** by reusing memory via internal pools.\n\n| Benchmark | Iterations | Time | Memory | Allocs |\n| :------ | :--: | :-----------: | :---: | :---------------: |\n| JSON | 5,316,435 | 198.1 ns/op | 0 B/op | 0 allocs/op |\n| Binary | 12,058,200 | 98.94 ns/op | 0 B/op | 0 allocs/op |\n_To run benchmarks yourself:_ `go test -bench=. -benchmem`\n\n## Installation\n\n```\ngo get github.com/banditmoscow1337/bark\n\n```\n\n## Usage\n\n### JSON Logging\n\nIdeal for cloud environments (ELK, Datadog, etc.) where human readability or standard ingestion is required.\n\n```\npackage main\n\nimport (\n\t\"os\"\n\t\"github.com/banditmoscow1337/bark\"\n)\n\nfunc main() {\n\tlogger := bark.NewLogger(os.Stdout)\n\t\n\tlogger.Info().\n\t\tStr(\"user_id\", \"u123\").\n\t\tInt(\"attempt\", 3).\n\t\tBool(\"success\", true).\n\t\tMsg(\"user login attempt\")\n}\n\n```\n\n### Binary Logging\n\nIdeal for internal microservices, high-frequency telemetry, or edge computing where performance and disk/network I/O are the primary constraints.\n\n```\npackage main\n\nimport (\n\t\"os\"\n\t\"github.com/banditmoscow1337/bark\"\n)\n\nfunc main() {\n\t// The binary format uses a tagged-length-value approach\n\tlogger := bark.NewBinaryLogger(os.Stdout)\n\t\n\tlogger.Info().\n\t\tFloat64(\"temp\", 36.6).\n\t\tUint64(\"id\", 882211).\n\t\tMsg(\"sensor_read\")\n}\n\n```\n\n## Binary Protocol Specification\n\nThe binary format follows a strict structure for fast parsing:\n\n1.  **Header (6 bytes)**: 2 bytes for Type, 4 bytes for Payload Length.\n    \n2.  **Timestamp (8 bytes)**: Nanoseconds since epoch (Little Endian).\n    \n3.  **Fields**: `[Key Length (1b)][Key][Tag (1b)][Value]`\n    \n    -   Strings/Bytes use a 2-byte length prefix.\n        \n    -   Numbers use standard fixed-width Little Endian encoding.\n        \n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanditmoscow1337%2Fbark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanditmoscow1337%2Fbark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanditmoscow1337%2Fbark/lists"}