in org.eclipse.sisu.inject/src/org/eclipse/sisu/inject/Logs.java [227:268]
private static String format( final String format, final Object arg )
{
final int len = format.length();
boolean detailed = true;
int cursor = 0;
for ( char prevChar = ' ', currChar; cursor < len; prevChar = currChar, cursor++ )
{
currChar = format.charAt( cursor );
if ( prevChar == '{' && currChar == '}' )
{
break; // replace anchor with String.valueOf
}
if ( prevChar == '<' && currChar == '>' )
{
detailed = false;
break; // use Logs.identityToString instead
}
}
if ( cursor >= len )
{
return format;
}
final StringBuilder buf = new StringBuilder();
if ( --cursor > 0 )
{
buf.append( format.substring( 0, cursor ) );
}
try
{
buf.append( detailed ? arg : identityToString( arg ) );
}
catch ( final RuntimeException e )
{
buf.append( e );
}
cursor += 2;
if ( cursor < len )
{
buf.append( format.substring( cursor, len ) );
}
return buf.toString();
}