Added build option log_level to allow the user to set the default log level for release builds.

This commit is contained in:
Omar Alhammadi 2021-11-02 19:42:06 +04:00 committed by Auguste Rame
parent 80f09831bc
commit 3531237afe
2 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,12 @@ pub fn build(b: *std.build.Builder) !void {
b.option(shared.ZigVersion, "data_version", "The Zig version your compiler is.") orelse .master,
);
exe_options.addOption(
std.log.Level,
"log_level",
b.option(std.log.Level, "log_level", "The Log Level to be used.") orelse .warn,
);
exe.addPackage(.{ .name = "known-folders", .path = .{ .path = "src/known-folders/known-folders.zig" } });
exe.addPackage(.{ .name = "zinput", .path = .{ .path = "src/zinput/src/main.zig" } });

View File

@ -33,7 +33,7 @@ pub const log_level = .debug;
var actual_log_level: std.log.Level = switch (zig_builtin.mode) {
.Debug => .debug,
else => .info,
else => build_options.log_level,
};
pub fn log(comptime message_level: std.log.Level, comptime scope: @Type(.EnumLiteral), comptime format: []const u8, args: anytype) void {