diff --git a/src/root.zig b/src/root.zig index 82ad36d..8c094d4 100644 --- a/src/root.zig +++ b/src/root.zig @@ -1,5 +1,6 @@ const std = @import("std"); const root = @import("root"); +const builtin = @import("builtin"); pub const options: Options = if (@hasDecl(root, "faller_options")) root.faller_options else .{}; @@ -24,6 +25,7 @@ pub const Options = struct { /// tags is present it **isn't** logged. May overwrite `tags_enabled`. tags_disabled: []const @Type(.enum_literal) = &.{}, buffer_size: u64 = 64, + disabled_in_test: bool = true, }; pub fn Logger(comptime base_tags: []const @Type(.enum_literal)) type { @@ -48,6 +50,8 @@ pub fn Logger(comptime base_tags: []const @Type(.enum_literal)) type { comptime format: []const u8, args: anytype, ) void { + if (options.disabled_in_test) return; + const all_tags = comptime base_tags ++ tags; if (!options.enabled(all_tags)) return;