On Mon, 2009-11-30 at 21:15 -0500, Kaiduan Xie wrote:
> Fredrik,
> 
> Adding line number and module name to the log is quite helpful to read
> the log, at least from my personal experience. 

Well, I'm not sure... I see the current (debug) log as more of a story
about what happened when YXA processed a message, and less like a mean
for people to see what code executed. I mean, if log lines are prefixed
with some kind of logical context (like "Transaction layer") it is
easier to understand what is actually going on, than if a lot of
different module names show up. It is reasonably easy to find the
correct call to logger:log even as it is, don't you think?

I do however appreciate that for some people, module name and line
number would be helpful when they try to become accustomed to the YXA
source code (like you do now). That is not an unimportant aspect.

I see module name and line number as even less appealing when it comes
to 'normal' log messages, but again perhaps useful for error log
messages.

> 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).

Minor point, OTP modules seem to use lower case macro names for this. I
do think

  ?yxa_debug("something : ~p", [X])

is less disturbing to the eye when reading code than

  ?YXA_DEBUG("something : ~p", [X]))

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

I don't know, but perhaps an alternative is to use a parse transform to
"secretly" turn logger:log/2 calls into logger:log/4 calls
including ?LINE and ?MODULE? I have never used parse transforms.

I would like to evaluate the visual effects of the change before
committing a change to all the logger:log calls, and ideally hear some
other peoples opinion in the matter. What do you other people reading
this think?

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

You are most welcome. Thanks for using it =).

/Fredrik


_______________________________________________
Yxa-devel mailing list
Yxa-devel@lists.su.se
https://lists.su.se/mailman/listinfo/yxa-devel

Reply via email to