[slf4j-dev] Add Supplier args methods for Logger on java 8.
Federico Fissore
federico at fissore.org
Fri Apr 19 16:35:31 CEST 2019
Support for lazy arguments evaluation should be part of slf4j 2.0
https://github.com/qos-ch/slf4j/pull/203
If you want to have it with current slf4j 1.x you can give slf4j-fluent
a try
https://github.com/ffissore/slf4j-fluent
cheers
federico
JICHUN LIU ha scritto il 19/04/19 alle 15:55:
>
> Hello.
>
> The java.util.function.Supplier is supported from Java 8.
>
> Some new methods like:
>
>
> public void debug(String format, Supplier<Object> argument);
>
> public void debug(String format, Supplier<Object>... arguments);
>
> may add to org.slf4j.Logger.
>
> Lazy computing improves performance.
>
> Old:
>
> log.info("INFO a {} b {}",JsonUtil.ObjectToJson(instance),"success");
>
>
> New:
>
> log.info("INFO a {} b {}",()->JsonUtil.ObjectToJson(instance),"success");
>
>
> The new one with better performance because the ObjectToJson called only
> on the info level or high.
>
> I found slf4j support jdk version older the 8. Maybe we can create a new
> module for JDK 8. Supplier on slf4j is really an exciting feature.
>
> Thanks!
>
> _______________________________________________
> slf4j-dev mailing list
> slf4j-dev at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-dev
>
More information about the slf4j-dev
mailing list