Thanks for the tip. The behavior actually seems to depend on 
std::cerr/stderr.. when stdout is used instead then the stacktrace is gone 
(i.e. works also in C).

To then also get rid of the annoying "source file" info console.log has to 
be replaced before the EMSCRIPTEN Module is instanciated, i.e. putting 
something like the below into the respective file does the trick (and it 
doesn't seem to have any negative effects on the scenarios where you 
actually want to log an error with stacktrace):

let origLog = console.log;
console.log = function(t) { 
setTimeout(origLog.bind(console, t)); // "lose" the original context
};

problem solved :-)
[email protected] schrieb am Freitag, 11. August 2023 um 14:15:43 
UTC+2:

>
> I sometimes just want to print trace output from the C/C++ side and I do 
> not care about the stack trace info in that scenario. I already do know 
> exactly where the messages come from and the stack unnecessarily bloats the 
> output by 1-2 orders of magnitude - sometimes slowing the browser to a 
> crawl due to the amount of data, and unnecessarily complicating the actual 
> use of the log data..
>
> How can EMSCRIPTEN's default impl of always including the stack info be 
> overridden to just print my plain fprint messages? 
>
>
> Instead of printf use std::cout << "your message" << yourObject << 
> std::endl, if you are in C++. That only prints that message, nothing else 
> (and does good formatting). I use that currently for debugging.
>
> Mike
> -- 
> www.soft-gems.net 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/9e4207cf-9802-4ce1-a5ed-1fd9696eada4n%40googlegroups.com.

Reply via email to