Skip to content

stackmagic/logger

Repository files navigation

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.orgTravicCI

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:

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"))} }

more information

About

Java format-string based logger that wraps slf4j

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published