Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Missing ?FUNCTION and ?ARITY macros
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Missing ?FUNCTION and ?ARITY macros


This library implements a parse transform to get the function anme and arity to make logging output more readable.

This code was written by Zoltan Lajos Kis and posted to the Erlang mailing list and can be found at:

Copied here to make it easily accessible using rebar.config

How to add

Just after the module/author directives add a compile directive to call the parse_transform function:

-compile({parse_transform, funcarity}).

Add an include directive to for the macro definitions:


Ensure the rebar.config has the appropriate additions:

  • in erl_opts add: {i, "apps/funcarity/include"}
  • in deps add: {funcarity, ".*", {git, "git://", "master"}}


Just use ?FUNCTION and ?ARITY in the same way as existing pre-defined macros like ?MODULE. e.g.

io:format("~ts:~ts/~b ~p~n", [?MODULE, ?FUNCTION, ?ARITY, Message])

Or use with some logging system like lager

For some example macros use:


Which contains ?DEBUG(Term), ?INFO(Term) and ?ERROR(Term) macros.

Something went wrong with that request. Please try again.