Skip to content

Logly.ZigHigh-Performance Logging for Zig

Production-ready structured logging with a clean, simple API

Logly.Zig

Quick Example

zig
const std = @import("std");
const logly = @import("logly");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer _ = gpa.deinit();

    // Enable ANSI colors on Windows (no-op on Linux/macOS)
    _ = logly.Terminal.enableAnsiColors();

    const logger = try logly.Logger.init(gpa.allocator());
    defer logger.deinit();

    // Each level colors the ENTIRE line (timestamp, level, message)
    // @src() is optional - enables file:line display when show_filename/show_lineno are true
    try logger.info(@src(), "Application started", .{});      // White line
    try logger.success(@src(), "Operation completed!", .{});  // Green line
    try logger.warn(@src(), "Low memory", .{});               // Yellow line (alias for warning)
    try logger.err(@src(), "Connection failed", .{});         // Red line
}

Why Logly-Zig?

  • Production Ready: Battle-tested features from Rust Logly, reimplemented in Zig
  • Zero Dependencies: Pure Zig implementation with no external dependencies
  • Memory Safe: Compile-time safety guarantees from Zig
  • Cross-Platform: Works on Linux, Windows, macOS, and more
  • Well Documented: Comprehensive guides and API documentation

Installation

Add to your build.zig.zon:

zig
.dependencies = .{
    .logly = .{
        .url = "https://github.com/muhammad-fiaz/logly.zig/archive/refs/tags/v0.0.4.tar.gz",
        .hash = "...",
    },
},

Get Started →

Released under the MIT License.