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

Joris Verschoor jbverschoor at gmail.com
Fri Sep 26 12:25:58 CEST 2008


Hi guys,
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20080926/18aa3cd4/attachment.htm>


More information about the slf4j-dev mailing list