0
\$\begingroup\$

I'm trying to see some values within an animation loop, and am naively just console.log'ing when I need to, however, this usually results in the browser crashing from all the logs.

I'm working in JavaScript, but I don't think this issue is specific to JavaScript. How do people usually debug within an animation loop to see what values are?

\$\endgroup\$
1
\$\begingroup\$

Use breakpoints. Every major browser has those right now, and if you are using any decently supported toolset (e.g. using javascript in some other context) it should also have support.

This lets you step through line by line and inspect whatever values you need to without having to constantly rerun your code with additional logging statements.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Store logs into array for later examination. Inspect in browser, or save to JSON file and feed to external scripts. If there is too much data: skip some % of logs, look at small slices of it, apply some strong filters, or calculate statistics. Use visualization (like D3 or pyplot) if you feel fancy.

Alternatively, it might be possible to limit number of log lines, though I've failed to find anything relevant.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.