public final class LoggingRpcClientBuilder extends LoggingDecoratorBuilder
LoggingRpcClient.| Modifier and Type | Method and Description |
|---|---|
LoggingRpcClient |
build(RpcClient delegate)
Returns a newly-created
LoggingRpcClient decorating delegate based on the properties of
this builder. |
LoggingRpcClientBuilder |
contentSanitizer(Function<Object,?> contentSanitizer)
Sets the
Function to use to sanitize request and response content before logging. |
LoggingRpcClientBuilder |
failureResponseLogLevel(LogLevel failedResponseLogLevel)
Sets the
LogLevel to use when logging failure responses (e.g., failed with an exception). |
LoggingRpcClientBuilder |
headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)
Sets the
Function to use to sanitize request, response and trailers before logging. |
LoggingRpcClientBuilder |
logger(org.slf4j.Logger logger)
Sets the
Logger to use when logging. |
Function<? super RpcClient,LoggingRpcClient> |
newDecorator()
Returns a newly-created
LoggingRpcClient decorator based on the properties of this builder. |
LoggingRpcClientBuilder |
requestContentSanitizer(Function<Object,?> requestContentSanitizer)
Sets the
Function to use to sanitize request content before logging. |
LoggingRpcClientBuilder |
requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)
Sets the
Function to use to sanitize request headers before logging. |
LoggingRpcClientBuilder |
requestLogLevel(LogLevel requestLogLevel)
Sets the
LogLevel to use when logging requests. |
LoggingRpcClientBuilder |
requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
Sets the
Function to use when mapping the log level of request logs. |
LoggingRpcClientBuilder |
requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
Sets the
Function to use to sanitize request trailers before logging. |
LoggingRpcClientBuilder |
responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)
Sets the
Function to use to sanitize a response cause before logging. |
LoggingRpcClientBuilder |
responseContentSanitizer(Function<Object,?> responseContentSanitizer)
Sets the
Function to use to sanitize response content before logging. |
LoggingRpcClientBuilder |
responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)
Sets the
Function to use to sanitize response headers before logging. |
LoggingRpcClientBuilder |
responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
Sets the
Function to use when mapping the log level of response logs. |
LoggingRpcClientBuilder |
responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
Sets the
Function to use to sanitize response trailers before logging. |
LoggingRpcClientBuilder |
sampler(Sampler<? super ClientRequestContext> sampler)
Sets the
Sampler that determines which request needs logging. |
LoggingRpcClientBuilder |
samplingRate(float samplingRate)
Sets the rate at which to sample requests to log.
|
LoggingRpcClientBuilder |
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, toStringpublic LoggingRpcClient build(RpcClient delegate)
LoggingRpcClient decorating delegate based on the properties of
this builder.public Function<? super RpcClient,LoggingRpcClient> newDecorator()
LoggingRpcClient decorator based on the properties of this builder.public LoggingRpcClientBuilder samplingRate(float samplingRate)
0.0 and 1.0 will
cause a random sample of the requests to be logged.public LoggingRpcClientBuilder sampler(Sampler<? super ClientRequestContext> sampler)
Sampler that determines which request needs logging.public LoggingRpcClientBuilder logger(org.slf4j.Logger logger)
LoggingDecoratorBuilderLogger to use when logging.
If unset, a default Logger will be used.logger in class LoggingDecoratorBuilderpublic LoggingRpcClientBuilder requestLogLevel(LogLevel requestLogLevel)
LoggingDecoratorBuilderLogLevel to use when logging requests. If unset, will use LogLevel.TRACE.requestLogLevel in class LoggingDecoratorBuilderpublic LoggingRpcClientBuilder 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 LoggingRpcClientBuilder 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 LoggingRpcClientBuilder requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
LoggingDecoratorBuilderFunction to use when mapping the log level of request logs.requestLogLevelMapper in class LoggingDecoratorBuilderpublic LoggingRpcClientBuilder responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
LoggingDecoratorBuilderFunction to use when mapping the log level of response logs.responseLogLevelMapper in class LoggingDecoratorBuilderpublic LoggingRpcClientBuilder 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 LoggingRpcClientBuilder 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 LoggingRpcClientBuilder requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize request trailers before logging. If unset,
will use Function.identity().requestTrailersSanitizer in class LoggingDecoratorBuilderpublic LoggingRpcClientBuilder responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
LoggingDecoratorBuilderFunction to use to sanitize response trailers before logging. If unset,
will use Function.identity().responseTrailersSanitizer in class LoggingDecoratorBuilderpublic LoggingRpcClientBuilder 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 LoggingRpcClientBuilder 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 LoggingRpcClientBuilder 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 LoggingRpcClientBuilder 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 LoggingRpcClientBuilder 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.