Class JsonLogFormatterBuilder
java.lang.Object
com.linecorp.armeria.common.logging.JsonLogFormatterBuilder
A builder implementation for
JsonLogFormatter
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newly-created JSONLogFormatter
based on the properties of this builder.contentSanitizer
(BiFunction<? super RequestContext, Object, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> contentSanitizer) Sets theBiFunction
to use to sanitize request and response content before logging.headersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> headersSanitizer) Sets theBiFunction
to use to sanitize request, response and trailers before logging.objectMapper
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Sets theObjectMapper
that will be used to convert an object into a JSON format message.requestContentSanitizer
(BiFunction<? super RequestContext, Object, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> requestContentSanitizer) Sets theBiFunction
to use to sanitize request content before logging.requestHeadersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> requestHeadersSanitizer) Sets theBiFunction
to use to sanitize request headers before logging.requestTrailersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> requestTrailersSanitizer) Sets theBiFunction
to use to sanitize request trailers before logging.responseContentSanitizer
(BiFunction<? super RequestContext, Object, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> responseContentSanitizer) Sets theBiFunction
to use to sanitize response content before logging.responseHeadersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> responseHeadersSanitizer) Sets theBiFunction
to use to sanitize response headers before logging.responseTrailersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> responseTrailersSanitizer) Sets theBiFunction
to use to sanitize response trailers before logging.
-
Method Details
-
objectMapper
public JsonLogFormatterBuilder objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Sets theObjectMapper
that will be used to convert an object into a JSON format message. -
requestHeadersSanitizer
public JsonLogFormatterBuilder requestHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> requestHeadersSanitizer) 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.HeadersSanitizer<String> headersSanitizer = HeadersSanitizer .builderForText() .sensitiveHeaders("Authorization", "Cookie") ... .build(); LogFormatter .builderForText() .requestHeadersSanitizer(headersSanitizer) ...
-
responseHeadersSanitizer
public JsonLogFormatterBuilder responseHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> responseHeadersSanitizer) 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.HeadersSanitizer<String> headersSanitizer = HeadersSanitizer .builderForText() .sensitiveHeaders("Set-Cookie") ... .build(); LogFormatter .builderForText() .responseHeadersSanitizer(headersSanitizer) ...
-
requestTrailersSanitizer
public JsonLogFormatterBuilder requestTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> requestTrailersSanitizer) Sets theBiFunction
to use to sanitize request trailers before logging. If unset, will not sanitize request trailers.HeadersSanitizer<String> headersSanitizer = HeadersSanitizer .builderForText() .sensitiveHeaders("...") ... .build(); LogFormatter .builderForText() .requestTrailersSanitizer(headersSanitizer) ...
-
responseTrailersSanitizer
public JsonLogFormatterBuilder responseTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> responseTrailersSanitizer) Sets theBiFunction
to use to sanitize response trailers before logging. If unset, will not sanitize response trailers.HeadersSanitizer<String> headersSanitizer = HeadersSanitizer .builderForText() .sensitiveHeaders("...") ... .build(); LogFormatter .builderForText() .responseTrailersSanitizer(headersSanitizer) ...
-
headersSanitizer
public JsonLogFormatterBuilder headersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> headersSanitizer) 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:HeadersSanitizer<String> headersSanitizer = HeadersSanitizer .builderForText() .sensitiveHeaders("...") ... .build(); builder.requestHeadersSanitizer(headersSanitizer); builder.requestTrailersSanitizer(headersSanitizer); builder.responseHeadersSanitizer(headersSanitizer); builder.responseTrailersSanitizer(headersSanitizer);
-
requestContentSanitizer
public JsonLogFormatterBuilder requestContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> requestContentSanitizer) 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. -
responseContentSanitizer
public JsonLogFormatterBuilder responseContentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> responseContentSanitizer) 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. -
contentSanitizer
public JsonLogFormatterBuilder contentSanitizer(BiFunction<? super RequestContext, Object, ? extends @Nullable com.fasterxml.jackson.databind.JsonNode> contentSanitizer) 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);
-
build
Returns a newly-created JSONLogFormatter
based on the properties of this builder.
-