Keep log format as "function() in file:line: msg", but pass the arguments in consistent order between the host and guest app.
This commit is contained in:
parent
44477782d8
commit
116e614ab6
|
@ -45,8 +45,8 @@ oc_log_output* OC_LOG_DEFAULT_OUTPUT = &oc_logDefaultOutput;
|
|||
|
||||
void platform_log_push(oc_log_output* output,
|
||||
oc_log_level level,
|
||||
const char* file,
|
||||
const char* function,
|
||||
const char* file,
|
||||
int line,
|
||||
const char* fmt,
|
||||
va_list ap)
|
||||
|
@ -60,7 +60,7 @@ void platform_log_push(oc_log_output* output,
|
|||
if(isatty(fd))
|
||||
{
|
||||
fprintf(output->f,
|
||||
"%s%s:%s %s in %s():%i: ",
|
||||
"%s%s:%s %s() in %s:%i: ",
|
||||
OC_LOG_FORMATS[level],
|
||||
OC_LOG_HEADINGS[level],
|
||||
OC_LOG_FORMAT_STOP,
|
||||
|
@ -71,7 +71,7 @@ void platform_log_push(oc_log_output* output,
|
|||
else
|
||||
{
|
||||
fprintf(output->f,
|
||||
"%s: %s in %s():%i: ",
|
||||
"%s: %s() in %s:%i: ",
|
||||
OC_LOG_HEADINGS[level],
|
||||
function,
|
||||
file,
|
||||
|
|
|
@ -50,18 +50,18 @@ static oc_log_output oc_logDefaultOutput = { .kind = ORCA_LOG_OUTPUT_CONSOLE };
|
|||
oc_log_output* OC_LOG_DEFAULT_OUTPUT = &oc_logDefaultOutput;
|
||||
|
||||
void ORCA_IMPORT(oc_bridge_log)(oc_log_level level,
|
||||
int fileLen,
|
||||
const char* file,
|
||||
int functionLen,
|
||||
const char* function,
|
||||
int fileLen,
|
||||
const char* file,
|
||||
int line,
|
||||
int msgLen,
|
||||
const char* msg);
|
||||
|
||||
void platform_log_push(oc_log_output* output,
|
||||
oc_log_level level,
|
||||
const char* file,
|
||||
const char* function,
|
||||
const char* file,
|
||||
int line,
|
||||
const char* fmt,
|
||||
va_list ap)
|
||||
|
@ -76,7 +76,7 @@ void platform_log_push(oc_log_output* output,
|
|||
|
||||
oc_str8 string = oc_str8_list_join(scratch.arena, ctx.list);
|
||||
|
||||
oc_bridge_log(level, strlen(file), file, strlen(function), function, line, oc_str8_ip(string));
|
||||
oc_bridge_log(level, strlen(function), function, strlen(file), file, line, oc_str8_ip(string));
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ void oc_log_set_level(oc_log_level level)
|
|||
|
||||
void platform_log_push(oc_log_output* output,
|
||||
oc_log_level level,
|
||||
const char* file,
|
||||
const char* function,
|
||||
const char* file,
|
||||
int line,
|
||||
const char* fmt,
|
||||
va_list ap);
|
||||
|
|
|
@ -134,10 +134,10 @@ void oc_bridge_clipboard_set_string(oc_wasm_str8 value)
|
|||
}
|
||||
|
||||
void oc_bridge_log(oc_log_level level,
|
||||
int fileLen,
|
||||
char* file,
|
||||
int functionLen,
|
||||
char* function,
|
||||
int fileLen,
|
||||
char* file,
|
||||
int line,
|
||||
int msgLen,
|
||||
char* msg)
|
||||
|
@ -179,14 +179,14 @@ void oc_bridge_log(oc_log_level level,
|
|||
}
|
||||
char* payload = (char*)entry + sizeof(log_entry);
|
||||
|
||||
entry->file.len = fileLen;
|
||||
entry->file.ptr = payload;
|
||||
payload += entry->file.len;
|
||||
|
||||
entry->function.len = functionLen;
|
||||
entry->function.ptr = payload;
|
||||
payload += entry->function.len;
|
||||
|
||||
entry->file.len = fileLen;
|
||||
entry->file.ptr = payload;
|
||||
payload += entry->file.len;
|
||||
|
||||
entry->msg.len = msgLen;
|
||||
entry->msg.ptr = payload;
|
||||
payload += entry->msg.len;
|
||||
|
@ -203,8 +203,8 @@ void oc_bridge_log(oc_log_level level,
|
|||
oc_list_push_back(&debug->logEntries, &entry->listElt);
|
||||
|
||||
oc_log_ext(level,
|
||||
file,
|
||||
function,
|
||||
file,
|
||||
line,
|
||||
"%.*s\n",
|
||||
msgLen,
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
"ret": {"name": "void", "tag": "v"},
|
||||
"args": [ {"name": "level",
|
||||
"type": {"name": "oc_log_level", "tag": "i"}},
|
||||
{"name": "fileLen",
|
||||
"type": {"name": "int", "tag": "i"}},
|
||||
{"name": "file",
|
||||
"type": {"name": "char*", "tag": "p"},
|
||||
"len": {"count": "fileLen"}},
|
||||
{"name": "functionLen",
|
||||
"type": {"name": "int", "tag": "i"}},
|
||||
{"name": "function",
|
||||
"type": {"name": "char*", "tag": "p"},
|
||||
"len": {"count": "functionLen"}},
|
||||
{"name": "fileLen",
|
||||
"type": {"name": "int", "tag": "i"}},
|
||||
{"name": "file",
|
||||
"type": {"name": "char*", "tag": "p"},
|
||||
"len": {"count": "fileLen"}},
|
||||
{"name": "line",
|
||||
"type": {"name": "int", "tag": "i"}},
|
||||
{"name": "msgLen",
|
||||
|
|
Loading…
Reference in New Issue