Output stream redirection - chung-leong/zigar GitHub Wiki
When Zig code is compiled for native execution, the following functions of the C library are intercepted at the OS level:
fputc
fprintf
fputs
fwrite
perror
printf
putc
putchar
puts
vfprintf
vprintf
write
When the write target is stdout
or stderr
, output is redirect to the JavaScript console. You can
use __zigar.connect() to redirect it to a function of your choice.
Redirection only applies to the module in question. Calls made by shared libraries are unaffected.
When compiled for WebAssembly, output is sent to JavaScript through WASI.