[erlang-questions] Why no ?FUNCTION macro

Adam Lindberg <>
Fri Sep 21 13:05:08 CEST 2007


Mats and Garry,

Actually that was exactly what I was looking for, I only had it in mind like
this (felt kind off natural):

error_logger:error_report([{module, ?MODULE}, {function, ?FUNCTION}, {error,
Error}]).

However, what you propose works well enough for my purposes!

Thanks,
Adam

On 9/21/07, mats cronqvist <> wrote:
>
> 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
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070921/ee4484a3/attachment.html>


More information about the erlang-questions mailing list