The main logging methods (Logger::trace(), Logger::debug(), etc.) currently
take two parameters: $message and $caller.

I traced the path by which the $caller parameter is passed on and it goes
like this:

1. The main logging methods pass it to Logger::log()
2. Logger::log()  passes it to Logger::forcedLog()
3. Logger::forcedLog() checks whether $caller is an exception and if it is
passes it to the LoggerLoggingEvent constructor as $thorwable (otherwise it
is ignored).
4. LoggerLoggingEvent constructor embeds it into $this->throwable.

This frankly makes no sense to me.

Is $caller is there to allow the user to add additional throwable
information along with a message? If so, I don't think that it works the way
it is implemented now.

Is this a remenant of some previous functionality? I cannot find a use case
which demonstrates it's usefulness.

If it serves no function, I propose that this parameter is removed. This
would enable implementation of parameterized logging similar to that of
SLF4J, as discussed in LOG4PHP-119.

Best regards,
Ivan

Reply via email to