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 AccessLogFactorycreateFilter(Predicate<AccessLogArgProvider> predicate) Helper method to create an access log factory that selectively enables access logs.static AccessLogFactorycreateFilter(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 providedPredicateis excluded from the access log. Other requests are logged using the default format.- Parameters:
predicate- the filter that returnstrueif the request should be logged,falseotherwise- Returns:
- an
AccessLogFactoryto 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 providedPredicateis excluded from the access log. Other requests are logged using the provided formattingFunction. Said function is expected tocreateanAccessLoginstance, defining both the String format and a vararg of the relevant arguments, extracted from theAccessLogArgProvider.- Parameters:
predicate- the filter that returnstrueif the request should be logged,falseotherwiseformatFunction- theAccessLogFactorythat createsAccessLoginstances, encapsulating the format and the extraction of relevant arguments- Returns:
- an
AccessLogFactoryto be used inHttpServer.accessLog(boolean, AccessLogFactory) - Since:
- 1.0.3
-