Interface AccessLogFactory
- All Superinterfaces:
Function<AccessLogArgProvider,
@Nullable AccessLog>
An interface to declare more concisely a
Function
that apply an AccessLog
by an
AccessLogArgProvider
.
Can be used in accessLog
method for example.
- Since:
- 1.0.3
- Author:
- Simon Baslé, Audrey Neveu
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic AccessLogFactory
createFilter
(Predicate<AccessLogArgProvider> predicate) Helper method to create an access log factory that selectively enables access logs.static AccessLogFactory
createFilter
(Predicate<AccessLogArgProvider> predicate, AccessLogFactory formatFunction) Helper method to create an access log factory that selectively enables access logs and customizes the format to apply.
-
Method Details
-
createFilter
Helper method to create an access log factory that selectively enables access logs.Any request (represented as an
AccessLogArgProvider
) that doesn't match the providedPredicate
is excluded from the access log. Other requests are logged using the default format.- Parameters:
predicate
- the filter that returnstrue
if the request should be logged,false
otherwise- Returns:
- an
AccessLogFactory
to be used inHttpServer.accessLog(boolean, AccessLogFactory)
- Since:
- 1.0.3
-
createFilter
static AccessLogFactory createFilter(Predicate<AccessLogArgProvider> predicate, AccessLogFactory formatFunction) Helper method to create an access log factory that selectively enables access logs and customizes the format to apply.Any request (represented as an
AccessLogArgProvider
) that doesn't match the providedPredicate
is excluded from the access log. Other requests are logged using the provided formattingFunction
. Said function is expected tocreate
anAccessLog
instance, defining both the String format and a vararg of the relevant arguments, extracted from theAccessLogArgProvider
.- Parameters:
predicate
- the filter that returnstrue
if the request should be logged,false
otherwiseformatFunction
- theAccessLogFactory
that createsAccessLog
instances, encapsulating the format and the extraction of relevant arguments- Returns:
- an
AccessLogFactory
to be used inHttpServer.accessLog(boolean, AccessLogFactory)
- Since:
- 1.0.3
-