top | item 6684061

WAT the WTF do programmers use as debug strings?

7 points| hodgesmr | 12 years ago |zachholman.com

10 comments

order
[+] forgottenpass|12 years ago|reply

    "\x1B[1;36;40m" "\n" "\x1B[0;37;40m"
I keep a file sitting around with versions for different colors/languages.
[+] splawn|12 years ago|reply
Thank you for this idea! My worst days will now be in color from now on. :)
[+] hiharryhere|12 years ago|reply
Any chance you could chuck those on a gist? Sounds mighty handy!
[+] bandy|12 years ago|reply
Really? I give location and context and the Why of the message. I make sure that every message is unique (unlike the code I changed in a certain once-prominent US firm's three-letter operating system) as well. I clearly know nothing and shouldn't be in the profession.
[+] caruana|12 years ago|reply
really? i think you might be mistaking exception logging for quick debug lines, like when a certain line isn't being hit for some reason and you just want to quickly know if it does hit. you would clearly delete these quick messages before checking in. No need to get so dramatic ...
[+] RossM|12 years ago|reply
In PHP I tend to do something like:

    dd(__DIR__.'/'.__FILE__.':'.__LINE__);
Which prints out the current script and line, and then stops execution (where dd is var_dump+exit).
[+] jweather|12 years ago|reply
"this should never happen" and/or "how did you get here?"
[+] NoodleIncident|12 years ago|reply
herp, derp, flurp, and slurp are immensely useful words for one-off variables in an interactive interpreter.