Skip to content

Commit

Permalink
util: fix log in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomsik committed Aug 16, 2024
1 parent 50036b1 commit b67674b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/util.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
const builtin = @import("builtin");
const std = @import("std");

pub const log = std.log.scoped(.fridge);
pub const log = if (builtin.is_test) struct { // zig build test captures stderr and there seems to be no f* way to disable it
pub fn debug(comptime fmt: []const u8, args: anytype) void {
std.debug.print("debug: " ++ fmt ++ "\n", args);
}

pub fn err(comptime fmt: []const u8, args: anytype) void {
std.debug.print("err: " ++ fmt ++ "\n", args);
}
} else std.log.scoped(.fridge);

pub fn tableName(comptime T: type) []const u8 {
return comptime brk: {
Expand Down

0 comments on commit b67674b

Please sign in to comment.