• mcv@lemmy.zip
    link
    fedilink
    arrow-up
    2
    ·
    9 hours ago

    I can also see the variables change by logging them.

    Debuggers are great if you want to see in detail what’s going on in a specific loop or something, but across a big application with a framework that handles lots of things in unreadable code, multiple components modifying your state, async code, etc.; debuggers are a terrible way to track what’s going on.

    And often when I’ve found where it goes wrong, I want to check what was happening in a previous bit of code, a previous iteration or call. Debuggers don’t go back; you have to restart and run through the whole thing, again finding exactly where it went wrong, but now just a bit before that, which is often impossible.

    With logging, you just log everything, print a big warning where the thing has gone wrong, and scroll back a bit.

    Debuggers are a fantastic bit of technology, but in practice, simple logging has helped me far more often. That said, there are issues where debuggers do beat logging, but they’re a small minority in my experience. Still useful to know both tools.