public String toLoggableString(ApiMessage message) {
        MetadataRecordType type = MetadataRecordType.fromId(message.apiKey());
        switch (type) {
            case CONFIG_RECORD: {
                if (!configSchema.isSensitive((ConfigRecord) message)) {
                    return message.toString();
                }
                ConfigRecord duplicate = ((ConfigRecord) message).duplicate();
                duplicate.setValue("(redacted)");
                return duplicate.toString();
            }
            case USER_SCRAM_CREDENTIAL_RECORD: {
                UserScramCredentialRecord record = (UserScramCredentialRecord) message;
                return "UserScramCredentialRecord("
                        + "name=" + ((record.name() == null) ? "null" : "'" + record.name() + "'")
                        + ", mechanism=" + record.mechanism()
                        + ", salt=(redacted)"
                        + ", storedKey=(redacted)"
                        + ", serverKey=(redacted)"
                        + ", iterations=" + record.iterations()
                        + ")";
            }
            default:
                return message.toString();
        }
    }
@Test
    public void testSensitiveConfigRecordToString() {
        assertEquals("ConfigRecord(resourceType=4, resourceName='0', name='quux', " +
            "value='(redacted)')",
                REDACTOR.toLoggableString(new ConfigRecord().
                    setResourceType(BROKER.id()).
                    setResourceName("0").
                    setName("quux").
                    setValue("mysecret")));
    }