public final class LoggingClientBuilder extends LoggingDecoratorBuilder
LoggingClient.| Constructor and Description |
|---|
LoggingClientBuilder()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
LoggingClient |
build(HttpClient delegate)
Returns a newly-created
LoggingClient decorating delegate based on the properties of
this builder. |
LoggingClientBuilder |
contentSanitizer(Function<Object,?> contentSanitizer)
Sets the
Function to use to sanitize request and response content before logging. |
LoggingClientBuilder |
failureResponseLogLevel(LogLevel failedResponseLogLevel)
Sets the
LogLevel to use when logging failure responses (e.g., failed with an exception). |
LoggingClientBuilder |
headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)
Sets the
Function to use to sanitize request, response and trailers before logging. |
LoggingClientBuilder |
logger(org.slf4j.Logger logger)
Sets the
Logger to use when logging. |
Function<? super HttpClient,LoggingClient> |
newDecorator()
Returns a newly-created
LoggingClient decorator based on the properties of this builder. |
LoggingClientBuilder |
requestContentSanitizer(Function<Object,?> requestContentSanitizer)
Sets the
Function to use to sanitize request content before logging. |
LoggingClientBuilder |
requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)
Sets the
Function to use to sanitize request headers before logging. |
LoggingClientBuilder |
requestLogLevel(LogLevel requestLogLevel)
Sets the
LogLevel to use when logging requests. |
LoggingClientBuilder |
requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
Sets the
Function to use when mapping the log level of request logs. |
LoggingClientBuilder |
requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
Sets the
Function to use to sanitize request trailers before logging. |
LoggingClientBuilder |
responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)
Sets the
Function to use to sanitize a response cause before logging. |
LoggingClientBuilder |
responseContentSanitizer(Function<Object,?> responseContentSanitizer)
Sets the
Function to use to sanitize response content before logging. |
LoggingClientBuilder |
responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)
Sets the
Function to use to sanitize response headers before logging. |
LoggingClientBuilder |
responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
Sets the
Function to use when mapping the log level of response logs. |
LoggingClientBuilder |
responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
Sets the
Function to use to sanitize response trailers before logging. |
LoggingClientBuilder |
sampler(Sampler<? super ClientRequestContext> sampler)
Sets the
Sampler that determines which request needs logging. |
LoggingClientBuilder |
samplingRate(float samplingRate)
Sets the rate at which to sample requests to log.
|
LoggingClientBuilder |
successfulResponseLogLevel(LogLevel successfulResponseLogLevel)
Sets the
LogLevel to use when logging successful responses (e.g., no unhandled exception). |
failedResponseLogLevel, logger, requestContentSanitizer, requestHeadersSanitizer, requestLogLevel, requestLogLevelMapper, requestTrailersSanitizer, responseCauseSanitizer, responseContentSanitizer, responseHeadersSanitizer, responseLogLevelMapper, responseTrailersSanitizer, successfulResponseLogLevel, toString@Deprecated public LoggingClientBuilder()
LoggingClient.builder().public LoggingClient build(HttpClient delegate)
LoggingClient decorating delegate based on the properties of
this builder.public Function<? super HttpClient,LoggingClient> newDecorator()
LoggingClient decorator based on the properties of this builder.public LoggingClientBuilder samplingRate(float samplingRate)
0.0 and 1.0 will
cause a random sample of the requests to be logged.public LoggingClientBuilder sampler(Sampler<? super ClientRequestContext> sampler)
Sampler that determines which request needs logging.public LoggingClientBuilder logger(org.slf4j.Logger logger)
LoggingDecoratorBuilderLogger to use when logging.
If unset, a default Logger will be used.logger in class LoggingDecoratorBuilderpublic LoggingClientBuilder requestLogLevel(LogLevel requestLogLevel)
LoggingDecoratorBuilderLogLevel to use when logging requests. If unset, will use LogLevel.TRACE.requestLogLevel in class LoggingDecoratorBuilderpublic LoggingClientBuilder successfulResponseLogLevel(LogLevel successfulResponseLogLevel)
LoggingDecoratorBuilderLogLevel to use when logging successful responses (e.g., no unhandled exception).
If unset, will use LogLevel.TRACE.successfulResponseLogLevel in class LoggingDecoratorBuilderpublic LoggingClientBuilder failureResponseLogLevel(LogLevel failedResponseLogLevel)
LoggingDecoratorBuilderLogLevel to use when logging failure responses (e.g., failed with an exception).
If unset, will use LogLevel.WARN. The request will be logged too if it was not otherwise.failureResponseLogLevel in class LoggingDecoratorBuilderpublic LoggingClientBuilder requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
LoggingDecoratorBuilderFunction to use when mapping the log level of request logs.requestLogLevelMapper in class LoggingDecoratorBuilderpublic LoggingClientBuilder responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
LoggingDecoratorBuilderFunction to use when mapping the log level of response logs.responseLogLevelMapper in class LoggingDecoratorBuilderpublic LoggingClientBuilder requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize request headers before logging. It is common to have the
Function that removes sensitive headers, like Cookie, before logging. If unset, will use
Function.identity().requestHeadersSanitizer in class LoggingDecoratorBuilderpublic LoggingClientBuilder responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize response headers before logging. It is common to have the
Function that removes sensitive headers, like Set-Cookie, before logging. If unset,
will use Function.identity().responseHeadersSanitizer in class LoggingDecoratorBuilderpublic LoggingClientBuilder requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize request trailers before logging. If unset,
will use Function.identity().requestTrailersSanitizer in class LoggingDecoratorBuilderpublic LoggingClientBuilder responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize response trailers before logging. If unset,
will use Function.identity().responseTrailersSanitizer in class LoggingDecoratorBuilderpublic LoggingClientBuilder headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize request, response and trailers before logging.
It is common to have the Function that removes sensitive headers, like "Cookie" and
"Set-Cookie", before logging. This method is a shortcut for:
builder.requestHeadersSanitizer(headersSanitizer);
builder.requestTrailersSanitizer(headersSanitizer);
builder.responseHeadersSanitizer(headersSanitizer);
builder.responseTrailersSanitizer(headersSanitizer);
headersSanitizer in class LoggingDecoratorBuilderLoggingDecoratorBuilder.requestHeadersSanitizer(Function),
LoggingDecoratorBuilder.requestTrailersSanitizer(Function),
LoggingDecoratorBuilder.responseHeadersSanitizer(Function),
LoggingDecoratorBuilder.responseTrailersSanitizer(Function)public LoggingClientBuilder requestContentSanitizer(Function<Object,?> requestContentSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize request content before logging. It is common to have the
Function that removes sensitive content, such as an GPS location query, before logging. If unset,
will use Function.identity().requestContentSanitizer in class LoggingDecoratorBuilderpublic LoggingClientBuilder responseContentSanitizer(Function<Object,?> responseContentSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize response content before logging. It is common to have the
Function that removes sensitive content, such as an address, before logging. If unset,
will use Function.identity().responseContentSanitizer in class LoggingDecoratorBuilderpublic LoggingClientBuilder contentSanitizer(Function<Object,?> contentSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize request and response content before logging. It is common
to have the Function that removes sensitive content, such as an GPS location query and
an address, before logging. If unset, will use Function.identity().
This method is a shortcut for:
builder.requestContentSanitizer(contentSanitizer);
builder.responseContentSanitizer(contentSanitizer);
public LoggingClientBuilder responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize a response cause before logging. You can
sanitize the stack trace of the exception to remove sensitive information, or prevent from logging
the stack trace completely by returning null in the Function. If unset, will use
Function.identity().responseCauseSanitizer in class LoggingDecoratorBuilderCopyright © 2020 LeanCloud. All rights reserved.