private void logResponse(final ShenyuContext shenyuContext, final BodyWriter writer) {
        if (StringUtils.isNotBlank(getHeaders().getFirst(HttpHeaders.CONTENT_LENGTH))) {
            String size = StringUtils.defaultIfEmpty(getHeaders().getFirst(HttpHeaders.CONTENT_LENGTH), "0");
            logInfo.setResponseContentLength(Integer.parseInt(size));
        } else if (Objects.nonNull(writer)) {
            logInfo.setResponseContentLength(writer.size());
        }
        logInfo.setTimeLocal(shenyuContext.getStartDateTime().format(DATE_TIME_FORMATTER));
        logInfo.setModule(shenyuContext.getModule());
        long costTime = DateUtils.acquireMillisBetween(shenyuContext.getStartDateTime(), LocalDateTime.now());
        logInfo.setUpstreamResponseTime(costTime);
        logInfo.setMethod(shenyuContext.getMethod());
        logInfo.setRpcType(shenyuContext.getRpcType());
        if (StringUtils.isNotBlank(shenyuContext.getRpcType())) {
            logInfo.setUpstreamIp(getUpstreamIp());
        }
        if (Objects.nonNull(writer)) {
            int size = writer.size();
            if (size > 0 && !LogCollectConfigUtils.isResponseBodyTooLarge(size)) {
                String body = writer.output();
                logInfo.setResponseBody(body);
            }
        } else {
            logInfo.setResponseBody("[bytes]");
        }

        // collect log
        if (Objects.nonNull(logCollector)) {
            // desensitize log
            if (desensitized) {
                logCollector.desensitize(logInfo, keyWordMatch, dataDesensitizeAlg);
            }
            logCollector.collect(logInfo);
        }
    }
record response log.

@param shenyuContext request context
@param writer        bodyWriter
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponse.java