Class LoggingRpcClientBuilder
java.lang.Object
com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
com.linecorp.armeria.client.logging.LoggingRpcClientBuilder
public final class LoggingRpcClientBuilder extends LoggingDecoratorBuilder
Builds a new
LoggingRpcClient
.-
Method Summary
Modifier and Type Method Description LoggingRpcClient
build(RpcClient delegate)
Returns a newly-createdLoggingRpcClient
decoratingdelegate
based on the properties of this builder.LoggingRpcClientBuilder
contentSanitizer(BiFunction<? super RequestContext,Object,?> contentSanitizer)
Sets theBiFunction
to use to sanitize request and response content before logging.LoggingRpcClientBuilder
failureResponseLogLevel(LogLevel failedResponseLogLevel)
Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception).LoggingRpcClientBuilder
headersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> headersSanitizer)
Sets theBiFunction
to use to sanitize request, response and trailers before logging.LoggingRpcClientBuilder
logger(String loggerName)
Sets the name of theLogger
to use when logging.LoggingRpcClientBuilder
logger(Logger logger)
Sets theLogger
to use when logging.Function<? super RpcClient,LoggingRpcClient>
newDecorator()
Returns a newly-createdLoggingRpcClient
decorator based on the properties of this builder.LoggingRpcClientBuilder
requestContentSanitizer(BiFunction<? super RequestContext,Object,?> requestContentSanitizer)
Sets theBiFunction
to use to sanitize request content before logging.LoggingRpcClientBuilder
requestHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestHeadersSanitizer)
Sets theBiFunction
to use to sanitize request headers before logging.LoggingRpcClientBuilder
requestLogLevel(LogLevel requestLogLevel)
Sets theLogLevel
to use when logging requests.LoggingRpcClientBuilder
requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
Sets theFunction
to use when mapping the log level of request logs.LoggingRpcClientBuilder
requestTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestTrailersSanitizer)
Sets theBiFunction
to use to sanitize request trailers before logging.LoggingRpcClientBuilder
responseCauseSanitizer(BiFunction<? super RequestContext,? super Throwable,?> responseCauseSanitizer)
Sets theBiFunction
to use to sanitize a response cause before logging.LoggingRpcClientBuilder
responseContentSanitizer(BiFunction<? super RequestContext,Object,?> responseContentSanitizer)
Sets theBiFunction
to use to sanitize response content before logging.LoggingRpcClientBuilder
responseHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseHeadersSanitizer)
Sets theBiFunction
to use to sanitize response headers before logging.LoggingRpcClientBuilder
responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
Sets theFunction
to use when mapping the log level of response logs.LoggingRpcClientBuilder
responseTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseTrailersSanitizer)
Sets theBiFunction
to use to sanitize response trailers before logging.LoggingRpcClientBuilder
sampler(Sampler<? super ClientRequestContext> sampler)
Sets theSampler
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 theLogLevel
to use when logging successful responses (e.g., no unhandled exception).Methods inherited from class com.linecorp.armeria.common.logging.LoggingDecoratorBuilder
logger, requestContentSanitizer, requestHeadersSanitizer, requestLogLevelMapper, requestTrailersSanitizer, responseCauseSanitizer, responseContentSanitizer, responseHeadersSanitizer, responseLogLevelMapper, responseTrailersSanitizer, toString
-
Method Details
-
build
Returns a newly-createdLoggingRpcClient
decoratingdelegate
based on the properties of this builder. -
newDecorator
Returns a newly-createdLoggingRpcClient
decorator based on the properties of this builder. -
samplingRate
Sets the rate at which to sample requests to log. Any number between0.0
and1.0
will cause a random sample of the requests to be logged. -
sampler
Sets theSampler
that determines which request needs logging. -
logger
Description copied from class:LoggingDecoratorBuilder
- Overrides:
logger
in classLoggingDecoratorBuilder
-
logger
Description copied from class:LoggingDecoratorBuilder
Sets the name of theLogger
to use when logging. This method is a shortcut forthis.logger(LoggerFactory.getLogger(loggerName))
.- Overrides:
logger
in classLoggingDecoratorBuilder
-
requestLogLevel
Description copied from class:LoggingDecoratorBuilder
Sets theLogLevel
to use when logging requests. If unset, will useLogLevel.DEBUG
.- Overrides:
requestLogLevel
in classLoggingDecoratorBuilder
-
successfulResponseLogLevel
Description copied from class:LoggingDecoratorBuilder
Sets theLogLevel
to use when logging successful responses (e.g., no unhandled exception). If unset, will useLogLevel.DEBUG
.- Overrides:
successfulResponseLogLevel
in classLoggingDecoratorBuilder
-
failureResponseLogLevel
Description copied from class:LoggingDecoratorBuilder
Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception). If unset, will useLogLevel.WARN
. The request will be logged too if it was not otherwise.- Overrides:
failureResponseLogLevel
in classLoggingDecoratorBuilder
-
requestLogLevelMapper
public LoggingRpcClientBuilder requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use when mapping the log level of request logs.- Overrides:
requestLogLevelMapper
in classLoggingDecoratorBuilder
-
responseLogLevelMapper
public LoggingRpcClientBuilder responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)Description copied from class:LoggingDecoratorBuilder
Sets theFunction
to use when mapping the log level of response logs.- Overrides:
responseLogLevelMapper
in classLoggingDecoratorBuilder
-
requestHeadersSanitizer
public LoggingRpcClientBuilder requestHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestHeadersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request headers before logging. It is common to have theBiFunction
that removes sensitive headers, likeCookie
, before logging. If unset, will not sanitize request headers.- Overrides:
requestHeadersSanitizer
in classLoggingDecoratorBuilder
-
responseHeadersSanitizer
public LoggingRpcClientBuilder responseHeadersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseHeadersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize response headers before logging. It is common to have theBiFunction
that removes sensitive headers, likeSet-Cookie
, before logging. If unset, will not sanitize response headers.- Overrides:
responseHeadersSanitizer
in classLoggingDecoratorBuilder
-
requestTrailersSanitizer
public LoggingRpcClientBuilder requestTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> requestTrailersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request trailers before logging. If unset, will not sanitize request trailers.- Overrides:
requestTrailersSanitizer
in classLoggingDecoratorBuilder
-
responseTrailersSanitizer
public LoggingRpcClientBuilder responseTrailersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> responseTrailersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize response trailers before logging. If unset, will not sanitize response trailers.- Overrides:
responseTrailersSanitizer
in classLoggingDecoratorBuilder
-
headersSanitizer
public LoggingRpcClientBuilder headersSanitizer(BiFunction<? super RequestContext,? super HttpHeaders,?> headersSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request, response and trailers before logging. It is common to have theBiFunction
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);
- Overrides:
headersSanitizer
in classLoggingDecoratorBuilder
- See Also:
LoggingDecoratorBuilder.requestHeadersSanitizer(BiFunction)
,LoggingDecoratorBuilder.requestTrailersSanitizer(BiFunction)
,LoggingDecoratorBuilder.responseHeadersSanitizer(BiFunction)
,LoggingDecoratorBuilder.responseTrailersSanitizer(BiFunction)
-
requestContentSanitizer
public LoggingRpcClientBuilder requestContentSanitizer(BiFunction<? super RequestContext,Object,?> requestContentSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request content before logging. It is common to have theBiFunction
that removes sensitive content, such as an GPS location query, before logging. If unset, will not sanitize request content.- Overrides:
requestContentSanitizer
in classLoggingDecoratorBuilder
-
responseContentSanitizer
public LoggingRpcClientBuilder responseContentSanitizer(BiFunction<? super RequestContext,Object,?> responseContentSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize response content before logging. It is common to have theBiFunction
that removes sensitive content, such as an address, before logging. If unset, will not sanitize response content.- Overrides:
responseContentSanitizer
in classLoggingDecoratorBuilder
-
contentSanitizer
public LoggingRpcClientBuilder contentSanitizer(BiFunction<? super RequestContext,Object,?> contentSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
to use to sanitize request and response content before logging. It is common to have theBiFunction
that removes sensitive content, such as an GPS location query and an address, before logging. If unset, will not sanitize content. This method is a shortcut for:builder.requestContentSanitizer(contentSanitizer); builder.responseContentSanitizer(contentSanitizer);
-
responseCauseSanitizer
public LoggingRpcClientBuilder responseCauseSanitizer(BiFunction<? super RequestContext,? super Throwable,?> responseCauseSanitizer)Description copied from class:LoggingDecoratorBuilder
Sets theBiFunction
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 returningnull
in theBiFunction
. If unset, will not sanitize a response cause.- Overrides:
responseCauseSanitizer
in classLoggingDecoratorBuilder
-