Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
Description
I found current Fluent API design a bit hard to read for two reasons:
- method names are too verbose
- Slightly counter-intuitive to have arguments before the log message
Especially the second issue, people (at least for me) found it hard to read as I need to twist my mind to find corresponding arguments before and after the message.
imho it looks a bit better to provide alternatives like this (totally fine to keep the original form)
logger.atDebug() .message("Temperature of {} rise from {} to {}" ) .arg(country).arg(oldTemp).arg(newTemp).log(); // equivalent to logger.atDebug() .addArgument(country).addArgument(oldTemp).addArgument(newTemp) .log("Temperature of {} rise from {} to {}"); // Compare to the old-style logger.debug("Temperature of {} rise from {} to {}", country, oldTemp, newTemp);