mach: put logFn function to std_options
This commit is contained in:
parent
c7b9d9e107
commit
192cacb85d
1 changed files with 13 additions and 11 deletions
|
|
@ -28,18 +28,20 @@ fn writeLog(_: void, msg: []const u8) LogError!usize {
|
||||||
return msg.len;
|
return msg.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn log(
|
pub const std_options = struct {
|
||||||
comptime message_level: std.log.Level,
|
pub fn logFn(
|
||||||
comptime scope: @Type(.EnumLiteral),
|
comptime message_level: std.log.Level,
|
||||||
comptime format: []const u8,
|
comptime scope: @Type(.EnumLiteral),
|
||||||
args: anytype,
|
comptime format: []const u8,
|
||||||
) void {
|
args: anytype,
|
||||||
const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
|
) void {
|
||||||
const writer = LogWriter{ .context = {} };
|
const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
|
||||||
|
const writer = LogWriter{ .context = {} };
|
||||||
|
|
||||||
writer.print(message_level.asText() ++ prefix ++ format ++ "\n", args) catch return;
|
writer.print(message_level.asText() ++ prefix ++ format ++ "\n", args) catch return;
|
||||||
js.machLogFlush();
|
js.machLogFlush();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
|
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
|
||||||
_ = error_return_trace;
|
_ = error_return_trace;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue