const std = @import("std"); const builtin = @import("builtin"); /// Workaround for failing tests when errors are logged /// https://github.com/ziglang/zig/issues/5738#issuecomment-1466902082 pub fn scoped_log_t(comptime scope: @Type(.EnumLiteral)) type { return if (builtin.is_test) // Downgrade `err` to `warn` for tests. // Zig fails any test that does `log.err`, but we want to test those code paths here. struct { pub const base = std.log.scoped(scope); pub const err = warn; pub const warn = base.warn; pub const info = base.info; pub const debug = base.debug; } else std.log.scoped(scope); }