44import io .apitally .common .ConsumerRegistry ;
55import io .apitally .common .LogAppender ;
66import io .apitally .common .RequestLogger ;
7+ import io .apitally .common .RequestLoggingConfig ;
78import io .apitally .common .SpanCollector ;
89import io .apitally .common .dto .Consumer ;
910import io .apitally .common .dto .Header ;
@@ -54,18 +55,20 @@ protected void doFilterInternal(
5455 return ;
5556 }
5657
58+ RequestLoggingConfig requestLoggingConfig = client .requestLogger .getConfig ();
59+ final boolean requestLoggingEnabled = requestLoggingConfig .isEnabled ();
60+
5761 String requestContentType = request .getContentType ();
5862 final boolean shouldCacheRequest =
59- client . requestLogger . getConfig (). isEnabled ()
60- && client . requestLogger . getConfig () .isRequestBodyIncluded ()
63+ requestLoggingEnabled
64+ && requestLoggingConfig .isRequestBodyIncluded ()
6165 && requestContentType != null
6266 && RequestLogger .ALLOWED_CONTENT_TYPES .stream ()
6367 .anyMatch (
6468 allowedContentType ->
6569 requestContentType .startsWith (allowedContentType ));
6670 final boolean shouldCacheResponse =
67- client .requestLogger .getConfig ().isEnabled ()
68- && client .requestLogger .getConfig ().isResponseBodyIncluded ();
71+ requestLoggingEnabled && requestLoggingConfig .isResponseBodyIncluded ();
6972 ContentCachingRequestWrapper cachingRequest =
7073 shouldCacheRequest ? new ContentCachingRequestWrapper (request ) : null ;
7174 ContentCachingResponseWrapper cachingResponse =
@@ -74,11 +77,9 @@ protected void doFilterInternal(
7477 cachingResponse == null ? new CountingResponseWrapper (response ) : null ;
7578
7679 final boolean shouldCaptureLogs =
77- client .requestLogger .getConfig ().isEnabled ()
78- && client .requestLogger .getConfig ().isLogCaptureEnabled ();
80+ requestLoggingEnabled && requestLoggingConfig .isLogCaptureEnabled ();
7981 final boolean shouldCaptureSpans =
80- client .requestLogger .getConfig ().isEnabled ()
81- && client .requestLogger .getConfig ().isTracingEnabled ();
82+ requestLoggingEnabled && requestLoggingConfig .isTracingEnabled ();
8283
8384 Exception exception = null ;
8485 final long startTime = System .currentTimeMillis ();
0 commit comments