@Test public void testFormattable() { Formattable arg = new Formattable() { @Override public void formatTo(Formatter formatter, int flags, int width, int precision) { try { formatter.out() .append(String.format("[f=%d,w=%d,p=%d]", flags, width, precision)); } catch (IOException e) { } } }; assertThat(log("%s", arg)).isEqualTo("[f=0,w=-1,p=-1]"); assertThat(log("%100s", arg)).isEqualTo("[f=0,w=100,p=-1]"); assertThat(log("%.25s", arg)).isEqualTo("[f=0,w=-1,p=25]"); assertThat(log("%100.25s", arg)).isEqualTo("[f=0,w=100,p=25]"); assertThat(log("%-100s", arg)).isEqualTo("[f=1,w=100,p=-1]"); assertThat(log("%S", arg)).isEqualTo("[f=2,w=-1,p=-1]"); assertThat(log("%#s", arg)).isEqualTo("[f=4,w=-1,p=-1]"); assertThat(log("%-#32.16S", arg)).isEqualTo("[f=7,w=32,p=16]"); }
public static void format(LogData logData, SimpleLogHandler receiver) { format(logData, receiver, Option.DEFAULT); }
SimpleMessageFormatter extends MessageBuilder<StringBuilder> implements ParameterVisitor { public static void format(LogData logData, SimpleLogHandler receiver) { format(logData, receiver, Option.DEFAULT); } }
SimpleMessageFormatter extends MessageBuilder<StringBuilder> implements ParameterVisitor { public static void format(LogData logData, SimpleLogHandler receiver) { format(logData, receiver, Option.DEFAULT); } private  SimpleMessageFormatter(TemplateContext context, Object[] args); }
SimpleMessageFormatter extends MessageBuilder<StringBuilder> implements ParameterVisitor { public static void format(LogData logData, SimpleLogHandler receiver) { format(logData, receiver, Option.DEFAULT); } private  SimpleMessageFormatter(TemplateContext context, Object[] args); static void format(LogData logData, SimpleLogHandler receiver); static String safeToString(Object value); @Override void addParameterImpl(int termStart, int termEnd, Parameter param); @Override StringBuilder buildImpl(); @Override void visit(Object value, FormatChar format, FormatOptions options); @Override void visitDateTime(Object value, DateTimeFormat format, FormatOptions options); @Override void visitPreformatted(Object value, String formatted); @Override void visitMissing(); @Override void visitNull(); }
SimpleMessageFormatter extends MessageBuilder<StringBuilder> implements ParameterVisitor { public static void format(LogData logData, SimpleLogHandler receiver) { format(logData, receiver, Option.DEFAULT); } private  SimpleMessageFormatter(TemplateContext context, Object[] args); static void format(LogData logData, SimpleLogHandler receiver); static String safeToString(Object value); @Override void addParameterImpl(int termStart, int termEnd, Parameter param); @Override StringBuilder buildImpl(); @Override void visit(Object value, FormatChar format, FormatOptions options); @Override void visitDateTime(Object value, DateTimeFormat format, FormatOptions options); @Override void visitPreformatted(Object value, String formatted); @Override void visitMissing(); @Override void visitNull();  }