LoggerUtil

This class provides some logger utility functions to allow lambda in the log messages. It uses Slf4J.

MessageSupplier

This is a functional interface that should be used to create a part of the whole trace message.

lazy

This function is used to pass a lambda as a parameter to a logger string format.

log.info("Value = {}", LoggerUtil.lazy(() -> "My computed parameter"));

trace / debug / info / warn / error

These functions make a trace at the specified level with a lambda as parameter.

LoggerUtil.trace(log, () -> "My computed message");

or

LoggerUtil.error(log, () -> "My computed message", exception);