static void formatMap( StringBuilder result, Map<String,Object> params ) { formatMap( result, params, Collections.emptySet() ); }
static void formatMapValue( StringBuilder result, MapValue params ) { formatMapValue( result, params, Collections.emptySet() ); }
if ( logDetailedTime ) QueryLogFormatter.formatDetailedTime( result, query ); QueryLogFormatter.formatAllocatedBytes( result, query ); QueryLogFormatter.formatPageDetails( result, query ); QueryLogFormatter.formatMapValue( result.append(" - "), query.queryParameters(), passwordParams ); QueryLogFormatter.formatMap( result.append(" - "), query.transactionAnnotationData() ); return result.toString();
static void formatMap( StringBuilder result, Map<String, Object> params, Collection<String> obfuscate ) { result.append( '{' ); if ( params != null ) { String sep = ""; for ( Map.Entry<String,Object> entry : params.entrySet() ) { result .append( sep ) .append( entry.getKey() ) .append( ": " ); if ( obfuscate.contains( entry.getKey() ) ) { result.append( "******" ); } else { formatValue( result, entry.getValue() ); } sep = ", "; } } result.append( "}" ); }
static void formatMapValue( StringBuilder result, MapValue params, Collection<String> obfuscate ) { result.append( '{' ); if ( params != null ) { String sep = ""; for ( Map.Entry<String,AnyValue> entry : params.entrySet() ) { result .append( sep ) .append( entry.getKey() ) .append( ": " ); if ( obfuscate.contains( entry.getKey() ) ) { result.append( "******" ); } else { result.append( formatAnyValue( entry.getValue() )); } sep = ", "; } } result.append( "}" ); }
private static void formatValue( StringBuilder result, Object value ) { if ( value instanceof Map<?,?> ) { formatMapValue( result, (MapValue) value ); } else if ( value instanceof String ) { result.append( '\'' ).append( value ).append( '\'' ); } else { result.append( Strings.prettyPrint( value ) ); } } }