public static HttpRequest setUpRequestContentPreviewer(
            RequestContext ctx, HttpRequest req, ContentPreviewer requestContentPreviewer,
            BiFunction<? super RequestContext, String, ? extends @Nullable Object> contentSanitizer) {
        requireNonNull(ctx, "ctx");
        requireNonNull(req, "req");
        requireNonNull(requestContentPreviewer, "requestContentPreviewer");
        requireNonNull(contentSanitizer, "contentSanitizer");
        if (requestContentPreviewer.isDisabled()) {
            return req;
        }

        final RequestLogBuilder logBuilder = ctx.logBuilder();
        logBuilder.defer(RequestLogProperty.REQUEST_CONTENT_PREVIEW);
        final FilteredHttpRequest filteredHttpRequest = new FilteredHttpRequest(req) {
            @Override
            protected HttpObject filter(HttpObject obj) {
                if (obj instanceof HttpData) {
                    requestContentPreviewer.onData((HttpData) obj);
                }
                return obj;
            }
        };
        filteredHttpRequest.whenComplete().handle((unused, cause) -> {
            @Nullable String produced = null;
            try {
                produced = requestContentPreviewer.produce();
                if (produced != null) {
                    produced = sanitize(contentSanitizer, ctx, produced);
                }
            } catch (Exception e) {
                logger.warn("Unexpected exception while producing the request content preview. " +
                            "previewer: {}", requestContentPreviewer, e);
            }
            logBuilder.requestContentPreview(produced);
            return null;
        });
        return filteredHttpRequest;
    }
Sets up the request {@link ContentPreviewer} to set
{@link RequestLogBuilder#requestContentPreview(String)} when the preview is available.
core/src/main/java/com/linecorp/armeria/internal/logging/ContentPreviewingUtil.java