Package org.zalando.logbook
Interface StructuredHttpLogFormatter
-
- All Superinterfaces:
HttpLogFormatter
@API(status=EXPERIMENTAL) public interface StructuredHttpLogFormatter extends HttpLogFormatter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
format(Map<String,Object> content)
Renders properties of an HTTP message into a JSON string.default String
format(Correlation correlation, HttpResponse response)
default String
format(Precorrelation precorrelation, HttpRequest request)
default Map<String,Object>
prepare(Correlation correlation, HttpResponse response)
Produces a map of individual properties from an HTTP response.default Map<String,Object>
prepare(Precorrelation precorrelation, HttpRequest request)
Produces a map of individual properties from an HTTP request.default Optional<Object>
prepareBody(HttpMessage message)
default Optional<Map<String,List<String>>>
prepareHeaders(HttpMessage message)
default String
preparePort(HttpRequest request)
-
-
-
Method Detail
-
format
default String format(Precorrelation precorrelation, HttpRequest request) throws IOException
- Specified by:
format
in interfaceHttpLogFormatter
- Throws:
IOException
-
format
default String format(Correlation correlation, HttpResponse response) throws IOException
- Specified by:
format
in interfaceHttpLogFormatter
- Throws:
IOException
-
format
String format(Map<String,Object> content) throws IOException
Renders properties of an HTTP message into a JSON string.- Parameters:
content
- individual parts of an HTTP message- Returns:
- the whole message as a JSON object
- Throws:
IOException
- if writing JSON output fails- See Also:
prepare(Precorrelation, HttpRequest)
,prepare(Correlation, HttpResponse)
-
prepare
default Map<String,Object> prepare(Precorrelation precorrelation, HttpRequest request) throws IOException
Produces a map of individual properties from an HTTP request.- Parameters:
precorrelation
- the correlationrequest
- the request- Returns:
- a map containing HTTP request attributes
- Throws:
IOException
- if reading body fails- See Also:
prepare(Correlation, HttpResponse)
,format(Map)
-
prepare
default Map<String,Object> prepare(Correlation correlation, HttpResponse response) throws IOException
Produces a map of individual properties from an HTTP response.- Parameters:
correlation
- the correlationresponse
- the response- Returns:
- a map containing HTTP response attributes
- Throws:
IOException
- if reading body fails- See Also:
prepare(Correlation, HttpResponse)
,format(Map)
-
preparePort
@Nullable default String preparePort(HttpRequest request)
-
prepareBody
default Optional<Object> prepareBody(HttpMessage message) throws IOException
- Throws:
IOException
-
-