{"id":16985573,"url":"https://github.com/hendriknielaender/zlog","last_synced_at":"2025-03-22T15:30:48.456Z","repository":{"id":203568740,"uuid":"709909738","full_name":"hendriknielaender/zlog","owner":"hendriknielaender","description":"🪵 structured logging library for zig","archived":false,"fork":false,"pushed_at":"2024-12-23T16:55:16.000Z","size":366,"stargazers_count":9,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T15:40:32.945Z","etag":null,"topics":["async","file-logger","json","lib","library","logging","network-logs","structured-logging","zig","zig-lib","zig-library","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/hendriknielaender.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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}},"created_at":"2023-10-25T16:26:18.000Z","updated_at":"2025-02-20T11:58:05.000Z","dependencies_parsed_at":"2023-11-16T00:34:02.145Z","dependency_job_id":"dc56fd89-478d-42a9-8ec2-40f809f641f5","html_url":"https://github.com/hendriknielaender/zlog","commit_stats":null,"previous_names":["hendriknielaender/zlog"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendriknielaender%2Fzlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendriknielaender%2Fzlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendriknielaender%2Fzlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendriknielaender%2Fzlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hendriknielaender","download_url":"https://codeload.github.com/hendriknielaender/zlog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244978432,"owners_count":20541854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["async","file-logger","json","lib","library","logging","network-logs","structured-logging","zig","zig-lib","zig-library","zig-package","ziglang"],"created_at":"2024-10-14T02:43:45.047Z","updated_at":"2025-03-22T15:30:48.118Z","avatar_url":"https://github.com/hendriknielaender.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!WARNING]  \n\u003e Still work in progress.\n\n# zlog - High-Performance Logging in Zig\n[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/hendriknielaender/zlog/blob/HEAD/LICENSE)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/hendriknielaender/zlog)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hendriknielaender/zlog/blob/HEAD/CONTRIBUTING.md)\n\u003cimg src=\"logo.png\" alt=\"zlog logo\" align=\"right\" width=\"20%\"/\u003e\n\nzlog is a high-performance, extensible logging library for Zig, designed to offer both simplicity and power in logging for system-level applications. Inspired by the best features of modern loggers and tailored for the Zig ecosystem, `zlog` brings structured, efficient, and flexible logging to your development toolkit.\n\n## Key Features\n\n- **High Performance**: Minimizes overhead, ensuring logging doesn't slow down your application.\n- **Asynchronous Logging**: Non-blocking logging to maintain application performance.\n- **Structured Logging**: Supports JSON and other structured formats for clear, queryable logs.\n- **Customizable Log Levels**: Tailor log levels to fit your application's needs.\n- **Redaction Capabilities**: Securely redact sensitive information from your logs.\n- **Extensible Architecture**: Plug in additional handlers for specialized logging (e.g., file, network).\n- **Cross-Platform Compatibility**: Consistent functionality across different platforms.\n- **Intuitive API**: A simple, clear API that aligns with Zig's philosophy.\n\n## Getting Started\n\n### Installation\n\n1. Declare zlog as a dependency in `build.zig.zon`:\n\n    ```diff\n    .{\n        .name = \"my-project\",\n        .version = \"1.0.0\",\n        .paths = .{\"\"},\n        .dependencies = .{\n    +       .zlog = .{\n    +           .url = \"https://github.com/hendriknielaender/zlog/archive/\u003cCOMMIT\u003e.tar.gz\",\n    +       },\n        },\n    }\n    ```\n\n2. Add it to your `build.zig`:\n\n    ```diff\n    const std = @import(\"std\");\n\n    pub fn build(b: *std.Build) void {\n        const target = b.standardTargetOptions(.{});\n        const optimize = b.standardOptimizeOption(.{});\n\n    +   const opts = .{ .target = target, .optimize = optimize };\n    +   const zlog_module = b.dependency(\"zlog\", opts).module(\"zlog\");\n\n        const exe = b.addExecutable(.{\n            .name = \"test\",\n            .root_source_file = .{ .path = \"src/main.zig\" },\n            .target = target,\n            .optimize = optimize,\n        });\n    +   exe.addModule(\"zlog\", zlog_module);\n        exe.install();\n\n        ...\n    }\n    ```\n\n3. Get zlog package hash:\n\n    ```\n    $ zig build\n    my-project/build.zig.zon:6:20: error: url field is missing corresponding hash field\n            .url = \"https://github.com/hendriknielaender/zlog/archive/\u003cCOMMIT\u003e.tar.gz\",\n                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n    note: expected .hash = \"\u003cHASH\u003e\",\n    ```\n\n4. Update `build.zig.zon` package hash value:\n\n    ```diff\n    .{\n        .name = \"my-project\",\n        .version = \"1.0.0\",\n        .paths = .{\"\"},\n        .dependencies = .{\n            .zlog = .{\n                .url = \"https://github.com/hendriknielaender/zlog/archive/\u003cCOMMIT\u003e.tar.gz\",\n    +           .hash = \"\u003cHASH\u003e\",\n            },\n        },\n    }\n    ```\n\n### Basic Usage\n\n```zig\nconst zlog = @import(\"zlog\");\n\n// Set up your logger\nvar logger = zlog.Logger.init(allocator, zlog.Level.Info, zlog.OutputFormat.JSON, handler);\n```\n\nHere is a basic usage example of zlog:\n```zig\n// Simple logging\nlogger.log(\"This is an info log message\");\n\n// Asynchronous logging\nlogger.asyncLog(\"This is an error log message\");\n```\n\n### Structured Logging\n```zig\n// Log with structured data\nlogger.info(\"Test message\", \u0026[_]kv.KeyValue{\n    kv.KeyValue{ .key = \"key1\", .value = kv.Value{ .String = \"value1\" } },\n    kv.KeyValue{ .key = \"key2\", .value = kv.Value{ .Int = 42 } },\n    kv.KeyValue{ .key = \"key3\", .value = kv.Value{ .Float = 3.14 } },\n});\n```\n\n## Contributing\n\nThe main purpose of this repository is to continue to evolve zlog, making it faster and more efficient. We are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving zBench.\n\n### Contributing Guide\n\nRead our [contributing guide](CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to zlog.\n\n### License\n\nzlog is [MIT licensed](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendriknielaender%2Fzlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhendriknielaender%2Fzlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendriknielaender%2Fzlog/lists"}