1

When I write draft and experimental code in Erlang I usually use this:

%%% Switch debugging output on/off:
-define(DBG(Str, Args), ok).
%-define(DBG(Str, Args), io:format(Str, Args)).

Commenting out just one line of code switches the debugging output to the console on and off.

?DBG("DEBUG: The function started ~n", [])

Thus I can use commenting in the code heavily.

Does something similar exist in Ruby?

skanatek
  • 5,133
  • 3
  • 47
  • 75

1 Answers1

4

Ruby Learning's section on logging might be helpful.

ezkl
  • 3,829
  • 23
  • 39