public abstract class LoggingDecoratorBuilder extends Object
| Constructor and Description |
|---|
LoggingDecoratorBuilder() |
| Modifier and Type | Method and Description |
|---|---|
LoggingDecoratorBuilder |
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.
|
LoggingDecoratorBuilder |
failureResponseLogLevel(LogLevel failedResponseLogLevel)
Sets the
LogLevel to use when logging failure responses (e.g., failed with an exception). |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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.
|
LoggingDecoratorBuilder |
requestLogLevel(LogLevel requestLogLevel)
Sets the
LogLevel to use when logging requests. |
protected Function<? super RequestOnlyLog,LogLevel> |
requestLogLevelMapper()
Returns the
LogLevel to use when logging request logs. |
LoggingDecoratorBuilder |
requestLogLevelMapper(Function<? super RequestOnlyLog,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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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. |
LoggingDecoratorBuilder |
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.
|
LoggingDecoratorBuilder |
successfulResponseLogLevel(LogLevel successfulResponseLogLevel)
Sets the
LogLevel to use when logging successful responses (e.g., no unhandled exception). |
String |
toString() |
public LoggingDecoratorBuilder logger(org.slf4j.Logger logger)
Logger to use when logging.
If unset, a default Logger will be used.protected org.slf4j.Logger logger()
Logger the user specified to use,
or null if not set and a default logger should be used.public LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder requestLogLevelMapper(Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper)
Function to use when mapping the log level of request logs.protected Function<? super RequestOnlyLog,LogLevel> requestLogLevelMapper()
LogLevel to use when logging request logs.public LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 for:
builder.requestHeadersSanitizer(headersSanitizer);
builder.requestTrailersSanitizer(headersSanitizer);
builder.responseHeadersSanitizer(headersSanitizer);
builder.responseTrailersSanitizer(headersSanitizer);
public LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 LoggingDecoratorBuilder 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 for:
builder.requestContentSanitizer(contentSanitizer);
builder.responseContentSanitizer(contentSanitizer);
public LoggingDecoratorBuilder 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.