public interface AccessLogFactory extends Function<AccessLogArgProvider,AccessLog>
Function
that apply an AccessLog
by an
AccessLogArgProvider
.
Can be used in accessLog
method for example.
Modifier and Type | Method and Description |
---|---|
static 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.
|
static AccessLogFactory createFilter(Predicate<AccessLogArgProvider> predicate)
Any request (represented as an AccessLogArgProvider
) that doesn't match the
provided Predicate
is excluded from the access log. Other requests are logged
using the default format.
predicate
- the filter that returns true
if the request should be logged, false
otherwiseAccessLogFactory
to be used in
HttpServer.accessLog(boolean, AccessLogFactory)
static AccessLogFactory createFilter(Predicate<AccessLogArgProvider> predicate, AccessLogFactory formatFunction)
Any request (represented as an AccessLogArgProvider
) that doesn't match the
provided Predicate
is excluded from the access log. Other requests are logged
using the provided formatting Function
.
Said function is expected to create
an AccessLog
instance,
defining both the String format and a vararg of the relevant arguments, extracted from the
AccessLogArgProvider
.
predicate
- the filter that returns true
if the request should be logged, false
otherwiseformatFunction
- the AccessLogFactory
that creates AccessLog
instances, encapsulating the
format
and the extraction of relevant argumentsAccessLogFactory
to be used in
HttpServer.accessLog(boolean, AccessLogFactory)