blob: dd81d5ff4a2ad6c2dc4ae5679871cd81dc391436 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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);
}
|