Fluent logger based on Google Flogger that provides conventional error, warn, info, debug, and trace levels, avoiding use of java.util.logging (JUL) levels in code that doesn't otherwise use JUL.
import com.digitalascent.logger.FluentLogger;
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
logger.atError().withCause(exception).log("Log message with: %s", argument);
This implementation differs from Google's FluentLogger in these ways:
- provides a different set of level selectors:
atError()
,atWarn()
,atInfo()
,atDebug()
,atTrace()
- returns an interface from
FluentLogger.forEnclosingClass()
instead of a concrete implementation - uses a static default method on the
FluentLogger
interface instead of on the concrete logger instance, allowing the implementation class to change w/o changing calling code - JDK 8+ is required