Simple structured logging in Zig (0.14).
  • Zig 92.3%
  • Nix 7.7%
Find a file
lukasl-dev 6baf57f1e9
Some checks failed
Test / tests (push) Has been cancelled
Update nix overlay
2025-12-10 04:30:54 +01:00
.github/workflows Setup project 2025-08-08 13:45:23 +02:00
src Update nix overlay 2025-12-10 04:30:54 +01:00
.envrc Update nix overlay 2025-12-10 04:30:54 +01:00
.gitignore Setup project 2025-08-08 13:45:23 +02:00
build.zig Add logging funcs 2025-08-08 20:05:48 +02:00
build.zig.zon Update nix overlay 2025-12-10 04:30:54 +01:00
flake.lock Update nix overlay 2025-12-10 04:30:54 +01:00
flake.nix Update nix overlay 2025-12-10 04:30:54 +01:00
LICENSE Initial commit 2025-08-08 13:43:14 +02:00
README.md Update README.md 2025-08-08 20:26:18 +02:00

zlog

Zig

Small helper on top of Zigs std.log that simplifies structured logging without additional heap allocations.

Installation

  • Zig 0.14.1+
  • Add the dependency:
    • zig fetch --save git+https://github.com/lukasl-dev/zlog.git
  • In your build.zig:
const dep = b.dependency("zlog", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("zlog", dep.module("zlog"));

Usage

const std = @import("std");
const zlog = @import("zlog");

pub fn main() void {
    zlog.info("user logged in", .{ .user = "alice", .id = 1 });
    zlog.scoped(.auth).debug("token issued", .{ .token = "abc123" });
}

Output:

info: user logged in. user=alice id=1
debug(auth): token issued. token=abc123