Ratakor/axe
A logging library for zig
master
A fully customizable logging library for the Zig programming language.
std.Options.LogFn
axe.logAt(@src(), ...)
Add it to an existing project with this command:
zig fetch --save git+https://github.com/Ratakor/axe
Then add the module to build.zig.
const axe = b.dependency("axe", .{}).module("axe");
exe.root_module.addImport("axe", axe);
const std = @import("std");
const axe = @import("axe").Axe(.{
// Config goes here.
.mutex = .{ .function = .progress_stderr },
});
// Replace the default logFn.
pub const std_options: std.Options = .{
.logFn = axe.log,
};
pub fn main() !void {
const allocator = std.heap.page_allocator;
try axe.init(allocator, null, null);
defer axe.deinit(allocator);
std.log.debug("Hello {s}!", .{ "World" });
axe.infoAt(@src(), "Some info with source location", .{});
}
Check example.zig for more!
See the API Documentation.