Use oc_bridge_log for pseudo _stderr_write

This commit is contained in:
gingerBill
2024-03-18 22:12:19 +00:00
parent 24d5a5c9b3
commit 08bd7a6018

View File

@@ -3,7 +3,7 @@
package runtime
@(private="file")
log_level :: enum i32 {
oc_log_level :: enum i32 {
ERROR,
WARNING,
INFO,
@@ -11,17 +11,24 @@ log_level :: enum i32 {
@(private="file", default_calling_convention="c")
foreign {
oc_log_ext :: proc(
level: log_level,
function: cstring,
file: cstring,
line: i32,
fmt: cstring,
#c_vararg args: ..any,
oc_bridge_log :: proc(
level: oc_log_level,
functionLen: i32,
function: cstring,
fileLen: i32,
file: cstring,
line: i32,
msgLen: i32,
msg: [^]byte,
) ---
}
_stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
oc_log_ext(.ERROR, "", "", 0, "%.*s", i32(len(data)), raw_data(data))
oc_bridge_log(.ERROR,
0, "",
0, "",
0,
i32(len(data)), raw_data(data),
)
return len(data), 0
}