[slf4j-user] RFC: slf4j-fluent

Federico Fissore federico at fissore.org
Wed Jan 9 12:54:08 CET 2019


Hi everyone

I've started coding a fluent API for slf4j, slf4j-fluent, which is 
available on github [0]

I started coding it after seeing Flogger [1]: I've found its API nice to 
read but I didn't want to change my code in order to use a different 
logging framework

slf4j-fluent is just syntactical sugar: it should make the code a little 
bit nicer to read and the lazy argument evaluation might be a good 
feature to have
its cost is not zero, as it creates a new object instance every time 
error/info/xxx methods are called, if logging is active.
such instance exposes one common interface to all logging levels, which 
removes the need to duplicate the code whenever you want to provide 
additional signatures (brand new features or plain method overloading 
for postponing implicit array creation when using varargs)

I would have proposed the code as a new module to slf4j, but the goal 
was to have a short syntax which meant using lambdas and thus java 8

What do you think?

Best regards

Federico

[0] https://github.com/ffissore/slf4j-fluent
[1] https://github.com/google/flogger


More information about the slf4j-user mailing list