public abstract class LoggingDecoratorBuilder<T extends LoggingDecoratorBuilder<T>> extends Object
| Constructor and Description |
|---|
LoggingDecoratorBuilder() |
| Modifier and Type | Method and Description |
|---|---|
T |
contentSanitizer(Function<Object,?> contentSanitizer)
Sets the
Function to use to sanitize request and response content before logging. |
protected LogLevel |
failedResponseLogLevel()
Deprecated.
It will be removed in the future.
|
T |
failureResponseLogLevel(LogLevel failedResponseLogLevel)
Sets the
LogLevel to use when logging failure responses (e.g., failed with an exception). |
T |
headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)
Sets the
Function to use to sanitize request, response and trailers before logging. |
protected org.slf4j.Logger |
logger()
Returns the
Logger the user specified to use,
or null if not set and a default logger should be used. |
T |
logger(org.slf4j.Logger logger)
Sets the
Logger to use when logging. |
protected Function<Object,?> |
requestContentSanitizer()
Returns the
Function to use to sanitize request content before logging. |
T |
requestContentSanitizer(Function<Object,?> requestContentSanitizer)
Sets the
Function to use to sanitize request content before logging. |
protected Function<? super HttpHeaders,?> |
requestHeadersSanitizer()
Returns the
Function to use to sanitize request headers before logging. |
T |
requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)
Sets the
Function to use to sanitize request headers before logging. |
protected LogLevel |
requestLogLevel()
Deprecated.
It will be removed in the future.
|
T |
requestLogLevel(LogLevel requestLogLevel)
Sets the
LogLevel to use when logging requests. |
protected Function<? super RequestLog,LogLevel> |
requestLogLevelMapper()
Returns the
LogLevel to use when logging request logs. |
T |
requestLogLevelMapper(Function<? super RequestLog,LogLevel> requestLogLevelMapper)
Sets the
Function to use when mapping the log level of request logs. |
protected Function<? super HttpHeaders,?> |
requestTrailersSanitizer()
Returns the
Function to use to sanitize request trailers before logging. |
T |
requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
Sets the
Function to use to sanitize request trailers before logging. |
protected Function<? super Throwable,?> |
responseCauseSanitizer()
Returns the
Function to use to sanitize response cause before logging. |
T |
responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)
Sets the
Function to use to sanitize a response cause before logging. |
protected Function<Object,?> |
responseContentSanitizer()
Returns the
Function to use to sanitize response content before logging. |
T |
responseContentSanitizer(Function<Object,?> responseContentSanitizer)
Sets the
Function to use to sanitize response content before logging. |
protected Function<? super HttpHeaders,?> |
responseHeadersSanitizer()
Returns the
Function to use to sanitize response headers before logging. |
T |
responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)
Sets the
Function to use to sanitize response headers before logging. |
protected Function<? super RequestLog,LogLevel> |
responseLogLevelMapper()
Returns the
LogLevel to use when logging response logs. |
T |
responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
Sets the
Function to use when mapping the log level of response logs. |
protected Function<? super HttpHeaders,?> |
responseTrailersSanitizer()
Returns the
Function to use to sanitize response trailers before logging. |
T |
responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
Sets the
Function to use to sanitize response trailers before logging. |
protected LogLevel |
successfulResponseLogLevel()
Deprecated.
It will be removed in the future.
|
T |
successfulResponseLogLevel(LogLevel successfulResponseLogLevel)
Sets the
LogLevel to use when logging successful responses (e.g., no unhandled exception). |
String |
toString() |
public T logger(org.slf4j.Logger logger)
Logger to use when logging.
If unset, a default Logger will be used.@Nullable protected org.slf4j.Logger logger()
Logger the user specified to use,
or null if not set and a default logger should be used.public T requestLogLevel(LogLevel requestLogLevel)
LogLevel to use when logging requests. If unset, will use LogLevel.TRACE.@Deprecated protected LogLevel requestLogLevel()
LogLevel to use when logging requests.public T successfulResponseLogLevel(LogLevel successfulResponseLogLevel)
LogLevel to use when logging successful responses (e.g., no unhandled exception).
If unset, will use LogLevel.TRACE.@Deprecated protected LogLevel successfulResponseLogLevel()
LogLevel to use when logging successful responses (e.g., no unhandled exception).public T failureResponseLogLevel(LogLevel failedResponseLogLevel)
LogLevel 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.@Deprecated protected LogLevel failedResponseLogLevel()
LogLevel to use when logging failure responses (e.g., failed with an exception).public T requestLogLevelMapper(Function<? super RequestLog,LogLevel> requestLogLevelMapper)
Function to use when mapping the log level of request logs.protected Function<? super RequestLog,LogLevel> requestLogLevelMapper()
LogLevel to use when logging request logs.public T responseLogLevelMapper(Function<? super RequestLog,LogLevel> responseLogLevelMapper)
Function to use when mapping the log level of response logs.protected Function<? super RequestLog,LogLevel> responseLogLevelMapper()
LogLevel to use when logging response logs.public T requestHeadersSanitizer(Function<? super HttpHeaders,?> requestHeadersSanitizer)
Function 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().protected Function<? super HttpHeaders,?> requestHeadersSanitizer()
Function to use to sanitize request headers before logging.public T responseHeadersSanitizer(Function<? super HttpHeaders,?> responseHeadersSanitizer)
Function 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().protected Function<? super HttpHeaders,?> responseHeadersSanitizer()
Function to use to sanitize response headers before logging.public T requestTrailersSanitizer(Function<? super HttpHeaders,?> requestTrailersSanitizer)
Function to use to sanitize request trailers before logging. If unset,
will use Function.identity().protected Function<? super HttpHeaders,?> requestTrailersSanitizer()
Function to use to sanitize request trailers before logging.public T responseTrailersSanitizer(Function<? super HttpHeaders,?> responseTrailersSanitizer)
Function to use to sanitize response trailers before logging. If unset,
will use Function.identity().protected Function<? super HttpHeaders,?> responseTrailersSanitizer()
Function to use to sanitize response trailers before logging.public T headersSanitizer(Function<? super HttpHeaders,?> headersSanitizer)
Function 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 of:
builder.requestHeadersSanitizer(headersSanitizer);
builder.requestTrailersSanitizer(headersSanitizer);
builder.responseHeadersSanitizer(headersSanitizer);
builder.responseTrailersSanitizer(headersSanitizer);
public T requestContentSanitizer(Function<Object,?> requestContentSanitizer)
Function 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().protected Function<Object,?> requestContentSanitizer()
Function to use to sanitize request content before logging.public T responseContentSanitizer(Function<Object,?> responseContentSanitizer)
Function 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().protected Function<Object,?> responseContentSanitizer()
Function to use to sanitize response content before logging.public T contentSanitizer(Function<Object,?> contentSanitizer)
Function 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 of:
builder.requestContentSanitizer(contentSanitizer);
builder.responseContentSanitizer(contentSanitizer);
public T responseCauseSanitizer(Function<? super Throwable,?> responseCauseSanitizer)
Function 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().protected Function<? super Throwable,?> responseCauseSanitizer()
Function to use to sanitize response cause before logging.Copyright © 2020 LeanCloud. All rights reserved.