remove logTags functionality
This commit is contained in:
27
src/root.zig
27
src/root.zig
@@ -18,7 +18,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 .{};
|
||||
|
||||
@@ -38,7 +37,6 @@ 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 = false,
|
||||
};
|
||||
|
||||
/// A Logger with prefixes.
|
||||
@@ -59,18 +57,7 @@ pub const Logger = struct {
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
logger.logTags(&.{tag}, format, args);
|
||||
}
|
||||
|
||||
/// Log with multiple `tags`. Checks whether the log is enabled.
|
||||
pub fn logTags(
|
||||
comptime logger: Logger,
|
||||
comptime tags: []const @Type(.enum_literal),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
if (builtin.is_test and options.disabled_in_test) return;
|
||||
const all_tags = logger.base_tags ++ tags;
|
||||
const all_tags = logger.base_tags ++ [_]@Type(.enum_literal){tag};
|
||||
options.function(all_tags, format, args);
|
||||
}
|
||||
};
|
||||
@@ -88,17 +75,7 @@ pub fn log(
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
logTags(&.{tag}, format, args);
|
||||
}
|
||||
|
||||
/// Log with multiple `tags`. Checks whether the log is enabled.
|
||||
pub fn logTags(
|
||||
comptime tags: []const @Type(.enum_literal),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
if (builtin.is_test and options.disabled_in_test) return;
|
||||
options.function(tags, format, args);
|
||||
options.function(&.{tag}, format, args);
|
||||
}
|
||||
|
||||
/// Checks whether the log is enabled for a specific combination of `tags`. Depends on the `options`
|
||||
|
||||
Reference in New Issue
Block a user