Hey everyone,

I'm interested in making a custom converter to replace the MessageConverter that renders certain objects differently depending on configuration.

Right now I have something like:

public class MyMessageConverter extends MessageConverter {

    @Override
    public String convert(ILoggingEvent event) {
        Object[] argumentArray = event.getArgumentArray();
        if (argumentArray != null) {
            for (Object o : argumentArray) {
                if (o.getClass() == BoardState.class) {
                    return MyMessageFormatter.arrayFormat(event.getMessage(), argumentArray, someOptions).getMessage();
                }
            }
        }
        return super.convert(event);
    }
}



Within 'MyMessageFormatter', which I copied from org.slf4j.helpers.MessageFormatter, I override String oAsString = o.toString(); within 'safeObjectAppend', depending on the class and the options. IE, I may want a simple string representation of a given object or something verbose. Essentially, I want to choose methods on those objects besides 'toString'.

It seems wrong to have to copy so much code, and would be great if MessageConverter was more extensible and didn't depend on the difficult to configure MessageFormatter. Am I going about this wrong?