im.aop.loggers.messageinterpolation.ExceptionStringSupplierRegistrar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of im-aop-loggers Show documentation
Show all versions of im-aop-loggers Show documentation
A handy and configurable sets of annotation-based loggers for Spring Boot that can
log every execution of a method when entering or exiting normally or abnormally, without you
writing a single line of code using aspect-oriented programming (AOP)
The newest version!
package im.aop.loggers.messageinterpolation;
public class ExceptionStringSupplierRegistrar implements StringSupplierRegistrar {
private static final String EXCEPTION_KEY = "exception";
@Override
public void register(StringSupplierLookup stringSupplierLookup, Throwable source) {
stringSupplierLookup.addStringSupplier(EXCEPTION_KEY, () -> exception(source));
}
private String exception(final Throwable exception) {
return "type=" + exception.getClass().getSimpleName() + ", message=" + exception.getMessage();
}
}