When debuging gen_server module, I want to record more details status.
init()->
put(?COMPLETED_COMMANDS,[]),
-ifdef(DEBUG).
put(?DETAIL_STATUS,[]),
-endif.
ok.
The compiler give the following error.
src/benvolio_command_cache.erl:34: syntax error before: ','
src/benvolio_command_cache.erl:36: syntax error before: '.'
src/benvolio_command_cache.erl:33: variable 'DEBUG' is unbound
src/benvolio_command_cache.erl:33: function ifdef/1 undefined
How to add debuging code lines in the *.erl file’s function?
Macro directives cannot be used inside functions. see 8.5 Flow Control in Macros.