Added build option log_level to allow the user to set the default log level for release builds.
This commit is contained in:
parent
80f09831bc
commit
3531237afe
@ -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,
|
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 = "known-folders", .path = .{ .path = "src/known-folders/known-folders.zig" } });
|
||||||
exe.addPackage(.{ .name = "zinput", .path = .{ .path = "src/zinput/src/main.zig" } });
|
exe.addPackage(.{ .name = "zinput", .path = .{ .path = "src/zinput/src/main.zig" } });
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ pub const log_level = .debug;
|
|||||||
|
|
||||||
var actual_log_level: std.log.Level = switch (zig_builtin.mode) {
|
var actual_log_level: std.log.Level = switch (zig_builtin.mode) {
|
||||||
.Debug => .debug,
|
.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 {
|
pub fn log(comptime message_level: std.log.Level, comptime scope: @Type(.EnumLiteral), comptime format: []const u8, args: anytype) void {
|
||||||
|
Loading…
Reference in New Issue
Block a user