As someone who knows how to use a debugger, I can say for sure that log debugging is fine and often my first approach. If you have a good mental model of the code and the issue, it’s usually just 1-2 logs to solve the problem.
Extremely helpful debugging race conditions
To me logging combined with a quick compilation has a good flow to it. Causes you to consider what you want to see and doesn’t change the workflow if multiple stacks are involved.
printf(“here”)printf(“here1”)printf(“here2”)
Too hard to find in a busy log.
console.log(‘===== here1’)
have been there though I first try
printf(“HERE1”)
This is the way Although I also like:
File 1:
print(0.1)
print(0.2)
File 2:
print(1.1)
print(1.2)
…Minimal c+p+e effort
I never felt a need to do it some other way
Goodluck to use debugger on client side where only bug happens
Can somebody reupload the image at a non-feddit.org host? Feddit is incredibly annoying in that it geoblocks most of Asia.
Meh
alert(“here”);
is betterNot sure why you would say that. An alert() does not show you where in the code the alert was called from. A console log would show you.
There was a time when there was no console.log in javascript. Oh and browsers didn’t even have developer tools.
I remember those days. My comment still stands, I don’t know how your new reply explains why alert() is better in any way, shape or form. 😅
Oh, it’s a joke with a touch of irony. Maybe even sprinkle some sarcasm in too.
Gotcha. It wasn’t clear to me but fair enough 👍
I don’t use the debugger. I just write perfect code.
/s
Old school. Also the flip side:
sudo tail -f /<path to server>/error.log
I am guilty of this but for a different reason: setting up debugging for clis in rust is hard
I love the debugger. I use it all the time I can. But when debugging cli it’s a pain as you need to go back in the launch.json file, remake the argument list, then come back to run debug, find out why tf it doesn’t find cargo when it’s the PATH… again, then actually debug.
I don’t feel at all guilty of doing this. Whatever works. Usually nothing is so complicated that I need to debug properly, instead of just inspecting some value along the way.
In fact, if it gets the bug resolved, it is—effectively—debugging.
Honestly I use debugger when I have to go deep into some library’s bullshit code. My stuff should be stable clean and understandable enough to quickly see what’s happening with console log.
If I were to find myself needing debugger all the time with breakpoints and all this shit, it means shits has gone sideways and we need to back up and re-evaluate the code.