/logger

Java format-string based logger that wraps slf4j

Primary LanguagePythonApache License 2.0Apache-2.0

logger

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.

find it on search.maven.org TravicCI

downloading

gradle

dependencies {
    compile 'net.swisstech:logger:+'
}

maven

<dependency>
    <groupId>net.swisstech</groupId>
    <artifactId>logger</artifactId>
    <version>...</version>
</dependency>

usage

essentially the same as what you're used to - except you can use format strings to log messages. here's an example:

import net.swisstech.logger.Logger;
import net.swisstech.logger.LoggerFactory;

public class YourClass {

    private static final Logger LOG = LoggerFactory.getLogger(YourClass.class);

    public void yourMethod(String name, int num) {

        // simple log
        LOG.info("Hello, %s!", name);

        // exception/throwable is always the last argument
        // and NOT part of the format string
        LOG.error("Oops %s caused %5d errors!", name, num, new Exception("testing"));
    }
}

more information