Skip to content

Commit d9df7c4

Browse files
authored
just fix the logging (#73468)
1 parent 2db51aa commit d9df7c4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/mono/wasm/runtime/debug.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export function mono_wasm_trace_logger(log_domain_ptr: CharPtr, log_level_ptr: C
480480
}
481481
}
482482

483-
export function setup_proxy_console(id: string, originalConsole: Console, origin: string): void {
483+
export function setup_proxy_console(id: string, console: any, origin: string): void {
484484
function proxyConsoleMethod(prefix: string, func: any, asJson: boolean) {
485485
return function (...args: any[]) {
486486
try {
@@ -514,11 +514,14 @@ export function setup_proxy_console(id: string, originalConsole: Console, origin
514514
};
515515
}
516516

517-
const originalConsoleObj: any = originalConsole;
517+
const originalConsole = {
518+
log: console.log,
519+
error: console.error
520+
};
518521
const methods = ["debug", "trace", "warn", "info", "error"];
519522
for (const m of methods) {
520-
if (typeof (originalConsoleObj[m]) !== "function") {
521-
originalConsoleObj[m] = proxyConsoleMethod(`console.${m}: `, originalConsole.log, false);
523+
if (typeof (console[m]) !== "function") {
524+
console[m] = proxyConsoleMethod(`console.${m}: `, originalConsole.log, false);
522525
}
523526
}
524527

@@ -546,7 +549,7 @@ export function setup_proxy_console(id: string, originalConsole: Console, origin
546549

547550
// redirect output early, so that when emscripten starts it's already redirected
548551
for (const m of ["log", ...methods])
549-
originalConsoleObj[m] = proxyConsoleMethod(`console.${m}`, send, true);
552+
console[m] = proxyConsoleMethod(`console.${m}`, send, true);
550553
}
551554

552555
type CallDetails = {

0 commit comments

Comments
 (0)