I'd like to request the following logger feature.

a. Replace the logger:log/3 call by macros:

-define(LOG_DEBUG(A, B),  logger:log(debug, A, B)).
-define(LOG_ERROR(A, B),  logger:log(error, A, B)).
-define(LOG_NORMAL(A, B), logger:log(normal, A, B)).

This way it'll be easy to exclude logging of specific types from 
compilation when not needed.

3. Replace the 3rd parameter of logger:log/3 by a macro:

-define(LAZY(L), fun() -> L end).

Sample call:

   before:

   logger:log(debug, "test ~s", [list:flatten(["one", " ", "two"])).

   after:

   logger:log(debug, "test ~s", ?LAZY([list:flatten(["one", "two"]))).

Why is it needed?

This way it'll be possible to enable/disable log level logging without 
recompilation, and not to have performance impact because of strict 
evaluation of parameters in the call to the logger when no logging is 
desired.

The logger:log/3 function would then do:

log(A, B, F) when is_function(F) ->
     log(A, B, F());
log(A, B, C) ->
     ...

What do you think?

Serge

-- 
Serge Aleynikov
Routing R&D, IDT Telecom
Tel: +1 (973) 438-3436
Fax: +1 (973) 438-1464
_______________________________________________
Yxa-devel mailing list
Yxa-devel@lists.su.se
https://lists.su.se/mailman/listinfo/yxa-devel

Reply via email to