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;
|
||||
}
|
||||
|
||||
pub fn log(
|
||||
pub const std_options = struct {
|
||||
pub fn logFn(
|
||||
comptime message_level: std.log.Level,
|
||||
comptime scope: @Type(.EnumLiteral),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
) void {
|
||||
const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
|
||||
const writer = LogWriter{ .context = {} };
|
||||
|
||||
writer.print(message_level.asText() ++ prefix ++ format ++ "\n", args) catch return;
|
||||
js.machLogFlush();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
|
||||
_ = error_return_trace;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue