Hi David,
First of all, I apologize in advanced for the long email. However, I
would be happy to receive your input for the possible solutions I'm
listing below.
I understand your proposal. What I'm thinking of right now is the
correct way to add this into Log4erl. The issue is that I don't have
access to client's data structure and I cannot do that without adding
some restrictions on how code that's using log4erl.
For example, the way log4erl is implemented currently is by having 1
process for each logger. So, if I wanted to add a check for log level
before sending log message, then I'll have to call the process for
querying log level, check it's OK to pass log message, which I would
expect to be as fast, if not slower, than just sending the log message
anyways.
Another solution is to add an extra parameter to Log4erl API to always
send log level used by client. This is not a particularly good
solution as well.
A third solution is to have 1 process between the actual logger
process and the client, which adds to overhead in terms of message
passing and delay before processing log messages. I'm not sure how
this solution fares compares to not having this complexity in Log4erl
code base.
A forth solution is to have Log4erl automatically generate logger code
using something like smerl (from erlyweb) and it has check for
different levels in code that is run by client. This of course will
require an extra step when creating loggers and will mean a small
change in Log4erl API (e.g. instead of log4erl:warn/1 ->
Logger:warn/1).
From all of the solutions mentioned above, I think the last option is
the best. If you have a better implementation idea, please let me
know.
Best regards,
Ahmed