226
PsiB0T
7y

Hoorah! My code finally works! Now gotta remove those 1000 print statements I used to identify the bugs 😥

Comments
  • 12
    I usually make a stub function named debugThis(...) , then I just comment the print function once and viola!
  • 12
    Why not use Breakpoints. As in debugger.
  • 2
    @juneeighteen this is smart, but you still have remove debugthis () in the end
  • 0
    @zyxel oops! I should go clean up some more one day ;)
  • 1
    @juneeighteen I know that feeling, just today I must prepare 2projects to demo
  • 2
    How about to use an program that filters the statements out, like sed?
  • 2
  • 3
    Some logging class is indeed the answer. The neatest way to set it up is a service like Sentry, Bugsnag, Rollbar, etc.
  • 0
    debugfunction(argument);

    Then
    /s/^*debugfunction(argument);*$//
  • 0
    I do this after finishing every class in my projects
    😂
  • 0
    Just make your own logging method and use it. Also make some kind of config and then you can toggle logging on/off easily.
    The next guy that comes to work on your code will appreciate it, especially if you use tags in your logs (related to method/task, I specify them in config).
Add Comment