Wrapper for slf4j Logger that uses format strings. The LoggerFactory is pre-coded by hand, the Logger itself generated with a python script that generates methods for up to 20 method arguments.
dependencies {
compile 'net.swisstech:logger:+'
}<dependency>
<groupId>net.swisstech</groupId>
<artifactId>logger</artifactId>
<version>...</version>
</dependency>essentially the same as what you're used to - except you can use format strings to log messages. here's an example:
importnet.swisstech.logger.Logger;
importnet.swisstech.logger.LoggerFactory;
publicclassYourClass {
privatestaticfinalLoggerLOG = LoggerFactory.getLogger(YourClass.class);
publicvoidyourMethod(Stringname, intnum) {
// simple logLOG.info("Hello, %s!", name);
// exception/throwable is always the last argument// and NOT part of the format stringLOG.error("Oops %s caused %5d errors!", name, num, newException("testing"));
}
}- slf4j: http://www.slf4j.org/
- java format strings: http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax