[erlang-questions] Why no ?FUNCTION macro

mats cronqvist <>
Fri Sep 21 11:12:08 CEST 2007


On Thu, 2007-09-20 at 15:35 +0100, G Bulmer wrote:
[...]
> As I said, this is only curiosity, but if the need is a run-time  
> name, maybe an ingenious function to dig through the stack trace  
> returned by erlang:get_stacktrace() would be workable.

  in that case, i think something like this is a lot simpler;

-define(LOG(T),error_logger:info_report([process_info(self(),current_function)|T])).

  e.g. 
go() -> ?LOG([{xxx,yyy}]).

  will print

=INFO REPORT==== 21-Sep-2007::11:08:38 ===
    current_function: {foo,go,0}
    xxx: yyy

  mats




More information about the erlang-questions mailing list