Debugging with Dev Tools
To console.log
or not to console.log
; that is the question. For the record, let me state that console.log
statements will never be checked in to your repository. In general, they are a waste of your time, because it requires editing, building, and running code to bring value, not to mention the cost of cleaning up your code later.
The preferred method of debugging is breakpoint debugging, which is a way to pause the execution of your code, and inspect and manipulate the state of it while your code is running. You can conditionally set breakpoints, walk through your code line by line, and even execute statements in the console to try out new ideas.
Angular 9 and Ivy bring in many debugging improvements that makes it possible to debug asynchronous code and templates. In addition, the stack trace generated by Angular 9 is far more useful in pinpointing the root cause of an error.
There are some niche use cases where console.log
statements...