fix for latest breaking libstd changes to Options

This commit is contained in:
Jakub Konka
2024-02-09 23:58:43 +01:00
committed by Mitchell Hashimoto
parent 28c078ec37
commit e32b4849d1

View File

@ -109,20 +109,13 @@ pub fn main() !MainReturn {
try app_runtime.run(); try app_runtime.run();
} }
pub const std_options = struct { // The function std.log will call.
// Our log level is always at least info in every build mode. pub fn logFn(
pub const log_level: std.log.Level = switch (builtin.mode) {
.Debug => .debug,
else => .info,
};
// The function std.log will call.
pub fn logFn(
comptime level: std.log.Level, comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral), comptime scope: @TypeOf(.EnumLiteral),
comptime format: []const u8, comptime format: []const u8,
args: anytype, args: anytype,
) void { ) void {
// Stuff we can do before the lock // Stuff we can do before the lock
const level_txt = comptime level.asText(); const level_txt = comptime level.asText();
const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): "; const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
@ -160,7 +153,15 @@ pub const std_options = struct {
nosuspend stderr.print(level_txt ++ prefix ++ format ++ "\n", args) catch return; nosuspend stderr.print(level_txt ++ prefix ++ format ++ "\n", args) catch return;
}, },
} }
} }
pub const std_options: std.Options = .{
// Our log level is always at least info in every build mode.
.log_level = switch (builtin.mode) {
.Debug => .debug,
else => .info,
},
.logFn = logFn,
}; };
/// This represents the global process state. There should only /// This represents the global process state. There should only