disable in test

This commit is contained in:
2025-10-27 14:14:36 +01:00
parent 2dea92dcd9
commit 6efcfcded9

View File

@@ -1,5 +1,6 @@
const std = @import("std"); const std = @import("std");
const root = @import("root"); const root = @import("root");
const builtin = @import("builtin");
pub const options: Options = if (@hasDecl(root, "faller_options")) root.faller_options else .{}; 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 is present it **isn't** logged. May overwrite `tags_enabled`.
tags_disabled: []const @Type(.enum_literal) = &.{}, tags_disabled: []const @Type(.enum_literal) = &.{},
buffer_size: u64 = 64, buffer_size: u64 = 64,
disabled_in_test: bool = true,
}; };
pub fn Logger(comptime base_tags: []const @Type(.enum_literal)) type { 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, comptime format: []const u8,
args: anytype, args: anytype,
) void { ) void {
if (options.disabled_in_test) return;
const all_tags = comptime base_tags ++ tags; const all_tags = comptime base_tags ++ tags;
if (!options.enabled(all_tags)) return; if (!options.enabled(all_tags)) return;