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 JsonNode> contentSanitizer) Sets theBiFunction
to use to sanitize request and response content before logging.headersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends JsonNode> headersSanitizer) Sets theBiFunction
to use to sanitize request, response and trailers before logging.objectMapper
(ObjectMapper objectMapper) Sets theObjectMapper
that will be used to convert an object into a JSON format message.requestContentSanitizer
(BiFunction<? super RequestContext, Object, ? extends JsonNode> requestContentSanitizer) Sets theBiFunction
to use to sanitize request content before logging.requestHeadersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends JsonNode> requestHeadersSanitizer) Sets theBiFunction
to use to sanitize request headers before logging.requestTrailersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends JsonNode> requestTrailersSanitizer) Sets theBiFunction
to use to sanitize request trailers before logging.responseContentSanitizer
(BiFunction<? super RequestContext, Object, ? extends JsonNode> responseContentSanitizer) Sets theBiFunction
to use to sanitize response content before logging.responseHeadersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends JsonNode> responseHeadersSanitizer) Sets theBiFunction
to use to sanitize response headers before logging.responseTrailersSanitizer
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends JsonNode> responseTrailersSanitizer) Sets theBiFunction
to use to sanitize response trailers before logging.
-
Method Details
-
objectMapper
Sets theObjectMapper
that will be used to convert an object into a JSON format message. -
build
Returns a newly-created JSONLogFormatter
based on the properties of this builder. -
requestHeadersSanitizer
public JsonLogFormatterBuilder requestHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends 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) ...
- See Also:
-
responseHeadersSanitizer
public JsonLogFormatterBuilder responseHeadersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends 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) ...
- See Also:
-
requestTrailersSanitizer
public JsonLogFormatterBuilder requestTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends 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) ...
- See Also:
-
responseTrailersSanitizer
public JsonLogFormatterBuilder responseTrailersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends 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) ...
- See Also:
-
headersSanitizer
public JsonLogFormatterBuilder headersSanitizer(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends 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);
- See Also:
-
requestContentSanitizer
public JsonLogFormatterBuilder requestContentSanitizer(BiFunction<? super RequestContext, Object, ? extends 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 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 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);
- See Also:
-