[slf4j-dev] Benefits of Message objects?

John Vasileff john.lists at gmail.com
Thu Sep 8 21:32:13 CEST 2011


In my previous emails, usage of lowercase message (the formatted string) and uppercase Message (the Message object) may be a bit confusing.

And, if a Message object is to be constructed, my thought is that it should encapsulate all data, including the Throwable.  This would help out when splitting off a trailing Throwable from the raw argument list when formatting a message.

So, a better name for the Message object may be Entry.  Entry would fully encapsulate all non NDC/MDC data including the lowercase raw and formatted message, parameters, a Throwable, and extra entry specific data.  Entry would be responsible for formatting.

public interface Entry {
  String getFormattedMessage();
  String getMessagePattern();
  Object[] getParameters();  // without trailing throwable
  Throwable getThrowable();
  Map<String, Object> getSupplementalData();
}


John


More information about the slf4j-dev mailing list