Add a third parameter of the log API if possible

Hi guys, I use slf4j log API for long time, one thing i feel inconvenience about it the default number of log API parameters is 2. For instance: public void warn(String format, Object arg1, Object arg2); Usually i log something in the 'who did what, and result is what ' style. e.g. LOG.info("User {} update post {}, result is {}", userId, postId, true); but the max number of parameters of this API is 2, so i need to write it like this: LOG.info("User {} update post {}, result is {}",new Object[]{ userId, postId, true}); I think the number of parameters of this API should be 3 and 3 is the most common cases for a meaning log info. Is this true or what are your concerns when you design the APIs? Best regards, George

Just make the damn methods varargs already! On Wednesday, April 11, 2012 at 4:18 AM, George Cao wrote:
Hi guys,
I use slf4j log API for long time, one thing i feel inconvenience about it the default number of log API parameters is 2. For instance: public void warn(String format, Object arg1, Object arg2);
Usually i log something in the 'who did what, and result is what ' style. e.g. LOG.info (http://LOG.info)("User {} update post {}, result is {}", userId, postId, true); but the max number of parameters of this API is 2, so i need to write it like this: LOG.info (http://LOG.info)("User {} update post {}, result is {}",new Object[]{ userId, postId, true});
I think the number of parameters of this API should be 3 and 3 is the most common cases for a meaning log info.
Is this true or what are your concerns when you design the APIs?
Best regards,
George
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch (mailto:slf4j-dev@qos.ch) http://mailman.qos.ch/mailman/listinfo/slf4j-dev
participants (2)
-
George Cao
-
Jason Dillon