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 testUserScramCredentialRecordToString() {
        assertEquals("UserScramCredentialRecord(name='bob', mechanism=0, " +
            "salt=(redacted), storedKey=(redacted), serverKey=(redacted), iterations=128)",
                REDACTOR.toLoggableString(new UserScramCredentialRecord().
                    setName("bob").
                    setMechanism((byte) 0).
                    setSalt(new byte[512]).
                    setServerKey(new byte[128]).
                    setStoredKey(new byte[128]).
                    setIterations(128)));
    }