[slf4j-user] Java 1.5 varargs + better signature?

Joern Huxhorn jhuxhorn at googlemail.com
Sun Sep 28 19:32:33 CEST 2008


Hi Joris,

please see

http://bugzilla.slf4j.org/show_bug.cgi?id=31

as well as

http://bugzilla.slf4j.org/show_bug.cgi?id=70

for a discussion on the subject.

Changing the method signatures as you suggested would make the API  
incompatible to previous versions so this can't be done.

Beside that, I personally dislike the idea of writing the exception  
argument before the message because, semantically, I want to log a  
message and the exception is merely context and therefore at the end.

Regards, Joern.

On 28.09.2008, at 12:11, Joris Verschoor wrote:

> Hi guys,
>
> (I sent this message to the dev-list, but I guess that was the wrong  
> place ;)
>
> I just migrated to slf4j, and that worked pretty good..
>
> I have some suggestions (ofcouse:))
>
> A Java5 version which supports varargs. I know that the method sigs  
> support Object[], but varargs add some sugar.
>
> Currently it is impossible to log an exception and parameterized args.
>
> I suggest the following signatures:
>
> info(Marker, Throwable, String message)
> info(Throwable, String message)
> info(Marker, String message)
>
> info(Marker, Throwable, String message, Object[] args)
> info(Throwable, String message, Object[] args)
> info(Marker, String message, Object[] args)
>
>
> Object[] args  can (and should also) be  various helpers like it is  
> now (1 and 2 Object args)
>
> The idea is to have the message and it's args as the last arguments.
>
> The problem with the current signatures is that Throwable comes  
> after the message and therefore making the args parameter ambiguous.
>
> </rant>
>
> Joris
>
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://www.slf4j.org/mailman/listinfo/user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20080928/96d1ef68/attachment.htm>


More information about the slf4j-user mailing list