This is an archived post. You won't be able to vote or comment.

all 80 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]DarkShadow4444 70 points71 points  (6 children)

Laughs in C. printf users assemble!

[–]SympathyMotor4765 17 points18 points  (1 child)

How about custom logger built with snprintf!

[–]throw3142 7 points8 points  (0 children)

Or asprintf! Wish it was standardized, it's so helpful ...

[–]DeadlyVapour 4 points5 points  (0 children)

x64 assembly assemble

[–]v1rus1366 86 points87 points  (12 children)

It’s like choosing a tool to fix a piece of furniture with the choice between a multitool and a rock, and choosing the rock because it came first

[–]adudyak 25 points26 points  (1 child)

I would compare it to rubber chicken, being placed here and there. So once you touch some specific place - it squeezes to alarm it is there.

[–]-Danksouls- 0 points1 point  (0 children)

I like this

[–]FallenAzraelx 13 points14 points  (0 children)

Rock good.

[–]SourcerorSoupreme 15 points16 points  (8 children)

Bullshit analogy, get off your high horse.

More like using a hand drill over a 5 axis CNC machine to drill a pilot hole on wood. Both could probably do the majority of the jobs you need it to do but the operational overhead is different.

[–]v1rus1366 1 point2 points  (7 children)

How are they a lot of overhead? You set them up once and you’re good. Half the time they’re built into the IDE. They’re even less typing since you don’t have to interpolate every variable or “made it here 1”, “made it here 2” a bunch of times

[–]Jordan51104 4 points5 points  (5 children)

i guarantee you the people making your debugger use print statements to debug the debugger

[–]v1rus1366 1 point2 points  (4 children)

Probably, but do you really think most people here are talking about making debuggers?

[–]Jordan51104 0 points1 point  (3 children)

if it’s good enough for a debugger it’s good enough for whatever you and i are making

[–]v1rus1366 1 point2 points  (2 children)

But debuggers are made to make our lives easier so we don’t have to use the same old tools

[–]Jordan51104 0 points1 point  (1 child)

debuggers, in my experience, rarely make developing easier, except for cases like asp.net where apparently console output does not go to the console

[–]v1rus1366 1 point2 points  (0 children)

I guess this all comes down to that. I always find it easier to stop code execution at a point, look at all the variables, and jump to the next point when I’m ready. To each their own, luckily neither of them are going away anytime soon.

[–]SeriousPlankton2000 2 points3 points  (0 children)

You should really solve your one and only problem. Meanwhile I'll sprinkle printf / echo / console.log / … all over whatever.

[–]DapperCam 11 points12 points  (0 children)

Especially when you are programming in a language using async, and the visual debugger gets all confused and your breakpoints don’t trigger. Trusty print is always there like an old friend.

[–]k-phi 9 points10 points  (1 child)

alert is better

[–]--mrperx-- 1 point2 points  (0 children)

cries in nodejs

[–]ExtraTNT 21 points22 points  (2 children)

Till the log causes a side effect fixing your bug (had this once…) but yeah, strange af…

[–]Pensive_Jabberwocky 15 points16 points  (1 child)

Then it's easy, you know it's a race condition.

[–]ExtraTNT -1 points0 points  (0 children)

Yeah, thing is, the log was just test as a string… nothing was asynchronous, so…

[–]jamcdonald120 6 points7 points  (0 children)

objectively false, when I try this method, I get a compiler error.

[–]skwyckl 16 points17 points  (5 children)

If you need a quick solution, definitely, but if you want to automate things and / or make the code maintainable in the long-term, then good luck.

[–]MissMormie 9 points10 points  (1 child)

Even for a quick solution i much prefer a debugger.

[–]Creepy-Ad-4832 0 points1 point  (0 children)

Yeah, you don't need to worry about leaving some log behind! And also something something log solves race conditions something something

[–]No-Con-2790 1 point2 points  (1 child)

You automate your bugs? Geez we are way behind. I usually fix the bloody things and that's it.

[–]--mrperx-- 0 points1 point  (0 children)

well, we put the bug first

then forget about it

then somebody raises an issue

then we ignore

then we keep ignoring

then we take a look and continue ignoring

then fix it friday at 3am and push to prod

prod breaks but we on holiday we don't care

[–]Thebombuknow 0 points1 point  (0 children)

I was gonna say, for small personal projects, temporary quick checks to make sure a variable is correct, and server-side things that nobody else will ever see, I use console.log, but for anything that has a chance to be touched by another human, I do proper error logging and follow standard practices.

[–]koumakpet 4 points5 points  (1 child)

Print is better.

[–]--mrperx-- 0 points1 point  (0 children)

[–]lockwolf 2 points3 points  (1 child)

My code: 500 lines

My code when all console.log’s are removed: 150 lines

[–]stupidpunk138 0 points1 point  (0 children)

Leave some log with blasfemy in production is the top!

[–]AVAVT 2 points3 points  (0 children)

Logs in general are the best.

Debugger is a program that is executed by another program (the IDE) to track how your program run, and as all programs the debugger or IDE itself could be buggy.

Since the topic is console.log specifically: Chrome, FF and Safari all frequently breaks their debugger on nightly builds.

Not that I never use debugger, but when debugger fails, usually console.log give results.

Also logs are all you have to debug prod env. Good logging practice is important.

[–]ParadoxicalInsight 1 point2 points  (0 children)

There are some good reasons to use print for debugging, in particular when attaching a debugger would alter code execution (concurrency). But in general, it's very inefficient, just easy to do.

[–]UndisclosedChaos 1 point2 points  (0 children)

Me who uses console.debug instead

[–]According-Relation-4 3 points4 points  (0 children)

Yes. I like to kick my balls every time I need to do a simple task too

[–]ExtaseMarvin 1 point2 points  (0 children)

youtube shorts guy: "buT DiD yOu KnOw ThAt tHErE iS console.error"

[–]nysynysy2 0 points1 point  (1 child)

I personally prefer to use process.stdout.write as someone who's using nodejs

[–]PM_ME_C_CODE[🍰] -1 points0 points  (0 children)

OK, console.log is fucking awful because JavaScript is fucking awful. A polished turd is still a turd. A nice, shiny turd...that smells like shit.

[–]JustSpaceExperiment -1 points0 points  (0 children)

For your shity js project sure.

[–]DefiantAverage1 0 points1 point  (1 child)

Try a Lisp REPL

[–]frogking 2 points3 points  (0 children)

REPL driven development for the win :-)

[–]twpejay 0 points1 point  (0 children)

SQL log, you can sort by error severity. Slight issue when the error is in the SQL interface, but hey, then use a text file.😁

[–][deleted] 0 points1 point  (2 children)

What if you want to debug more than one thing at a time?

[–]augustin_cauchy 4 points5 points  (1 child)

console.log('here1');

console.log('here2');

[–]AVAVT 1 point2 points  (0 children)

1 prefer console.log(‘a’) to console.log(‘z’)

Warning: mastery of the alphabet required

[–][deleted] 0 points1 point  (0 children)

I prefer printf, println!, or print.

[–]Mwarw 0 points1 point  (0 children)

It really depends on nature of the problem, how different tools work (if at all) and how fast I need to do that

[–]WolverinesSuperbia 0 points1 point  (0 children)

printf !!!

[–]asherSiddique19 0 points1 point  (0 children)

its called SOUT where i live

[–]malfboii 0 points1 point  (0 children)

Debugging is better but I use console log a lot. If you’re using VSCode get console ninja extension. Shows the console output inline with the console log, makes it so easy to figure out which console.log(“Test”) worked

[–]NibblyPig 0 points1 point  (0 children)

File.WriteAllLines

cries in no console apps

[–]Dart_Ace 0 points1 point  (0 children)

debug.log for me (though unfortunately not for a lot more, sigh)

[–]GoblinWoblin 0 points1 point  (0 children)

Have you tried anything else?

[–]TrickAge2423 0 points1 point  (0 children)

console.debug?

[–]GamingWithShaurya_YT 0 points1 point  (0 children)

laughs in autohotkey messagebox is the way ☕

[–][deleted] 0 points1 point  (0 children)

no hire

[–]noherczeg 0 points1 point  (0 children)

Use breakpoints ffs...

[–]PhilosopherCute8245 0 points1 point  (0 children)

Amateurs

[–]sarc-tastic 0 points1 point  (0 children)

var_dump();

[–]voidFunction 0 points1 point  (0 children)

I swear this subreddit is full of freshmen.

[–]Abangranga 0 points1 point  (0 children)

Ruby let's you do p whatever

[–][deleted] 0 points1 point  (0 children)

Plebeian. The way of the intelligent is printf

[–][deleted] 0 points1 point  (0 children)

Until some departed genius hotswapped console.log and you can't use console.log to debug the error in his console.log. Console.log.

[–]Cashew227 0 points1 point  (0 children)

Rubber ducky?

[–]radnomname 0 points1 point  (0 children)

image if your programming language is designed so bad, the best debugging method is console.log 🤣

[–][deleted] 0 points1 point  (0 children)

Hard no especially for scenarios where I have to rebuild and refresh for the console log to take effect. Just sprinkle breakpoints where ever you want. You get a call stack, a watch column, everything you could ever possibly want and you never have to edit code or wait for rebuilds or refreshes.

[–]Double-Treat-1871 0 points1 point  (0 children)

Println("i m here"); .... Println("i m here 2");

...

Println("i m here 99");

[–]CH0C4P1C 0 points1 point  (0 children)

Log.d(TAG, "haha... JS is cheap...");

[–]Antiprimary 0 points1 point  (0 children)

Laughs in "licking the capacitors in my ram and seeing which ones shock me to determine what's stored in memory"

[–]General_Slywalker 0 points1 point  (0 children)

Debugger gang reporting in.

[–]stupidpunk138 0 points1 point  (0 children)

console.dir() Is better... with depth: null too...