Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-367

Improved (more flexible, faster) slf4j message formatter

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core API
    • Labels:
      None

      Description

      The curent org.slf4j.helpers.MessageFormatter is a bit restrictive in its usability.

      I ended up writing my own (starting from the slf4j formatter) to address its shortcomings:
      https://github.com/zolyfarkas/spf4j/blob/master/spf4j-core/src/main/java/org/spf4j/base/Slf4jMessageFormatter.java

      My implementation basically does:
      1) Allow to format to a provided destination (Appendable) allowing you to reduce the amount of garbage generated...
      2) Lets you know which arguments have been used in the message allowing you to implement extra logic to handle the unused ones
      3) Lets you plug custom formatters for argument types. (you can get better performance and more flexibility)
      4) Processing arguments that are arrays is sligtly faster than the stock slf4j formatter.

      would there be any interest in improving the slf4j formatter?

        Attachments

          Activity

            People

            • Assignee:
              slf4j-dev SLF4J developers list
              Reporter:
              zolyfarkas Zoltan Farkas
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: