Guest User

Untitled

a guest
Nov 18th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. %%% Switch debugging output on/off:
  2. %-define(DBG(Str, Args), ok).
  3. -define(DBG(Str, Args), io:format(Str, Args)).
  4.  
  5. ?DBG("Function fun1 starting... ~n", [])
  6.  
  7. ?debugMsg("Function fun1 starting...")
  8.  
  9. ?debugFmt("Function fun1 starting...", [])
  10.  
  11. -include_lib("eunit/include/eunit.hrl").
  12.  
  13. %% If compiled with {d, TEST, true}
  14. %% This happens automatically during `rebar3 eunit`
  15. -ifdef(TEST).
  16. -define(TRACE(Template, Args), io:format(user, "TRACE ~p:~p ~p~n", [?MODULE, ?LINE, lists:flatten(Args)])).
  17. -else.
  18. -define(TRACE(_T, _A), void).
  19. -endif.
  20.  
  21. -module(foo).
  22. -export([ api/1 ]).
  23.  
  24. -include("trace.hrl").
  25.  
  26. api(Arg) ->
  27. ?TRACE("Called with Arg ~p~n", [Arg]),
  28. ok.
Add Comment
Please, Sign In to add comment