Skip to content

Commit

Permalink
Expose logPrefix in ClientResponse
Browse files Browse the repository at this point in the history
This commit exposes the logPrefix field in the ClientResponse interface.

Closes gh-24146
  • Loading branch information
poutsma committed Dec 13, 2019
1 parent 63844c6 commit 09b6730
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Expand Up @@ -204,6 +204,19 @@ public interface ClientResponse {
*/
Mono<WebClientResponseException> createException();

/**
* Return a log message prefix to use to correlate messages for this response.
* The prefix is based on the {@linkplain ClientRequest#logPrefix() client
* log prefix}, which itself is based on the value of the request attribute
* {@link ClientRequest#LOG_ID_ATTRIBUTE} along with some extra formatting
* so that the prefix can be conveniently prepended with no further
* formatting no separators required.
* @return the log message prefix or an empty String if the
* {@link ClientRequest#LOG_ID_ATTRIBUTE} was not set.
* @since 5.2.3
*/
String logPrefix();


// Static builder methods

Expand Down
Expand Up @@ -225,6 +225,11 @@ public Mono<WebClientResponseException> createException() {
});
}

@Override
public String logPrefix() {
return this.logPrefix;
}

// Used by DefaultClientResponseBuilder
HttpRequest request() {
return this.requestSupplier.get();
Expand Down
Expand Up @@ -153,6 +153,11 @@ public Mono<WebClientResponseException> createException() {
return this.delegate.createException();
}

@Override
public String logPrefix() {
return this.delegate.logPrefix();
}

/**
* Implementation of the {@code Headers} interface that can be subclassed
* to adapt the headers in a
Expand Down

0 comments on commit 09b6730

Please sign in to comment.