Stop console.trace from automaticly expanding in Chrome

5

I'm working on a project where some library calls console.trace every refresh. Chrome then automaticly unfolds the trace, so that it takes over 20 lines on the console.

This takes too much space and I would much rather have it folded by default and only unfold when I click on it, like with litteraly everything else in the JS console.

Can this be done in Google Chrome, preferably without an extension? I have looked at all the option, but this seems to be impossible to disable.

kajacx

Posted 2017-07-11T15:09:22.597

Reputation: 233

1You could maybe override console.trace with custom code (in the development environment only). I'm not sure if this approach can solve your problem, it's just an idea to explore. – thirtydot – 2017-07-11T16:16:35.247

Answers

0

The answer is here https://stackoverflow.com/questions/52595559/how-to-log-js-stack-trace-with-console-trace-but-keep-it-collapsed

console.groupCollapsed('name to show to identify trace');
console.log('additional data hidden inside collapsed group');
console.trace(); // hidden in collapsed group
console.groupEnd();

szym

Posted 2017-07-11T15:09:22.597

Reputation: 101

The trace is coming from in some JS library, so this solution would require me to override it, which would be possible I guess, however I wanted to know if it is possible to collapse trace log in browser by default, instead of changing the JS code. – kajacx – 2019-09-15T19:44:50.803