I like to have more control over the output format and data input by
separating these things.
How can I do this?

I would like to do something like this:
Logger.debug("some debug data", "Member", this.member, "Address",
this.address);

Then the formatter would output something like this:
Some debug data.
Member= [mem...@dfsdf,  id=2434, ....]
Address= [adr...@dafa, street=bla, postalCode=34324234, ...]

The text between [] is the toString output.
I use this in other parts, like in my asserts and toString logging since a
few years now, and like it: development friendly, that is: easy usage in
code and readably output (especially with complex data structures this is a
requirement).

I could do the above through a static Utils method, something like this:
UtilsLogger.debug(logger, "some debug data", "Member", this.member,
"Address", this.address);
And then the Utils method will construct the complete log statement with the
{} in it.
But might it not an idea to make this part of the Logger Facade?.. Or is
there a way to extend SLF4j to add this myself?

Please some advice?
Ed



_______________________________________________
slf4j-user mailing list
slf4j-user@qos.ch
http://qos.ch/mailman/listinfo/slf4j-user

Reply via email to