[slf4j-dev] Better printing method signatures?

Ceki Gülcü listid at qos.ch
Mon Jun 27 19:50:07 CEST 2005


At 06:53 AM 6/19/2005, Niclas Hedhman wrote:

>The only negative thing about many methods that I can think of, is 
>unittesting
>becomes slightly more 'tiring'. That made me think that we should perhaps
>provide a "slf4j-unit.jar" which is SLF4J tailored for unittesting, which is
>as light weight as possible, and maybe contain verification methods of
>expected input.

Testing? Why, that's my favorite topic. The tricky code is in the
formatter which can be tested in a single TestCase class. The code in
the printing methods look to me as being quite short and obvious, so I
wouldn't bother unit testing those, at least not at the SLF4J
level. But maybe I misunderstood the intent. Are you suggesting
slf4j-unit.jar designed specifically for unit testing? How would that
be different than say slf4j-simple.jar ?


> > Looking at the javadocs for Logger [1], I can't help but notice how
> > weird the argument name "parameterizedMsg" looks. So instead of
> >
> >    debug(String parameterizedMsg, Object param1)
>agree this is somewhat 'less clear',
>
> >    debug(String format, Object param1)
>but I don't think this is much better,
>
> >    debug(String msg, Object param1)
>and 'msg' should be 'message', but even if it lacks communication, I can't
>think of anything better.


The venerable printf() method in the C language refers to its first
argument as "format". In books, one talks about the "format string". I
think that the distinction between "message string" and "format
string" is useful.  The message string is what gets ultimately logged
whereas the format string is the string that will be used to create
the message string substituting formatting arguments as specified in
the format string. The distinction disappears in the case of the
debug(String msg) method when no arguments are present.

We also have the backing of the Jetty community. As such, I'll go
ahead to commit the proposed changes.



>Cheers
>Niclas

-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/





More information about the slf4j-dev mailing list