public void logRequest(Config config, HttpRequest request) {
        requestCount++;
        String uri = request.getUrl();
        HttpLogModifier requestModifier = logModifier(config, uri);
        String maskedUri = requestModifier == null ? uri : requestModifier.uri(uri);
        StringBuilder sb = new StringBuilder();
        sb.append("request:\n").append(requestCount).append(" > ")
                .append(request.getMethod()).append(' ').append(maskedUri);
        logHeaders(requestCount, " > ", sb, requestModifier, request.getHeaders());
        ResourceType rt = ResourceType.fromContentType(request.getContentType());
        if (rt == null || rt.isBinary()) {
            // don't log body
        } else {
            byte[] body;
            if (rt == ResourceType.MULTIPART) {
                body = request.getBodyForDisplay() == null ? null : request.getBodyForDisplay().getBytes();
            } else {
                body = request.getBody();
            }
            logBody(config, requestModifier, sb, uri, body, true, rt);
        }
        sb.append('\n');
        logger.debug("{}", sb);
    }
@Test
    void testRequestLoggingJson() {
        HttpRequest httpRequest = httpRequestBuilder.body("{a: 1}").contentType("application/json").path("/ttl").build();
        httpLogger.logRequest(config, httpRequest);
        String logs = logAppender.collect();
        assertTrue(logs.contains("{a: 1}"));
        assertTrue(logs.contains("Content-Type: application/json"));
    }