My team still use console.log for debuging instead of breakpoints, I don't really care about it when the code in development, but I really hate it when it goes to production.

I search in the project and found total 231 of console.log with allow console rules above it, I mean why don't you just delete it after the code is working, it's not that hard rather than to delete all console before goes to prod.

  • 4
    Kill then all, and find a new team.
  • 3
    Ah, the Colombiano approach. Classic.
  • 0
    Who the fu.... why would that be allowed to happen? That's like selling a car with a quarter of the tools used to build it in the trunk.
  • 0
  • 0
    What we do is add a var debug = true/false

    And then

    If (debug) console.log()

    Logs are useful, you never know when you break some old logic somewhere or if the backend suddenly stops working and having these debugging lines ready can help.

    My philosophy is to keep as much debugging information in the code as possible, but to be able to switch it off or on like on backend.

    Im not a FE dev myself, so maybe theres a library for it? Breakpoints are cool, but they don't show you the entire flow of the runtime, and navigating the stacktrace is slower in most cases.

    Sometimes you don't want to take out the drill if the screwdriver is already on the table
  • 0
    @SortOfTested in this case, the reasonable approach.
Add Comment