Adding line number and module name to the log is quite helpful to read
the log, at least from my personal experience. I agreed with you that
in order to to do that we need to change a lot of code in YXA, for
example replacing the log with macro.

-define DEBUG(Formats, Parameter)
    logger:log(DEBUG, ?LINE, ?MODULE, Formats, Parameter).

How do you think, Fredrik? I will check out the code to add log level
check, and submit a patch.

BTW, as a long time SIP developer, YXA attracts me because it is
written in Erlang. Thanks for sharing this with us.


On Mon, Nov 30, 2009 at 10:23 AM, Fredrik Thulin <> wrote:
> On Mon, 2009-11-30 at 10:10 -0500, Kaiduan Xie wrote:
> ...
>> > Ejabberd's solution sounds neat, but I think it should be measured
>> > against the much simpler variant of adding a case statement checking the
>> > log level before calling format_msg in logger:do_log/3.
>> Then we need to save the log level to ETS or Mnesia, and every time,
>> you want to log, we need to read from ETS/Mnesia.
> Yes, a configurable log level should be added (see
> src/include/yxa_config.hrl).
>> Compared with other
>> cost, for example, paring SIP message, reading ETS/Mnesia is not a big
>> issue. But Ejabberd's solution is neat.
> Agreed.
>> I also would  like to add line number and module name to the logger.
> Is that necessary? I'm not sure it adds much, and it would require
> adding at least ?LINE (and ?MODULE unless you deduct that from a stack
> trace in logger (at a cost)) to _every_ call to logger:log/3 in YXA.
>> Where can I check out the code from trunk?
> See Subversion topic at
> /Fredrik
Yxa-devel mailing list

Reply via email to