221
Madness or brilliance
(lemmy.ml)
Post funny things about programming here! (Or just rant about your favourite programming language.)
Sometimes there’s literally no other way (that I know of). When you’re debugging concurrency issues, stopping all time with a debugger just isn’t an option.
I guess, there's technically nothing which dictates that a debugger has to work by stepping through a program. It could also present you some diagram of variable values changing over time. But yeah, gonna be hard to find a more useful representation than those values being interleaved with your logs, at least for most applications. I have heard of more advanced debuggers being used in gamedev, which makes sense, since logs aren't nearly as useful there.
But yeah, given that most people think of the stepping debuggers, them being the default advice does feel emblematic of our industry still shying away from concurrency.
console.log("functionOne", "A", varA, "B", varB, "C", varC);console.log('func', {A, B, C})While that works, of course, I avoid doing object construction or other logic beside some string concatenation in JS logs. And those string literals serve a purpose as semantic markers, not just as separators.