public interface ErrorLogFactory extends Function<ErrorLogArgProvider,ErrorLog>
Function
that apply an ErrorLog
by an
ErrorLogArgProvider
.
Can be used in errorLog
method for example.
Modifier and Type | Method and Description |
---|---|
static ErrorLogFactory |
createFilter(Predicate<ErrorLogArgProvider> predicate)
Helper method to create an error log factory that selectively enables error logs.
|
static ErrorLogFactory |
createFilter(Predicate<ErrorLogArgProvider> predicate,
ErrorLogFactory formatFunction)
Helper method to create an error log factory that selectively enables error logs and customizes
the format to apply.
|
static ErrorLogFactory createFilter(Predicate<ErrorLogArgProvider> predicate)
Any exception (represented as an ErrorLogArgProvider
) that doesn't match the
provided Predicate
is excluded from the error log. Other exceptions are logged
using the default format.
predicate
- the filter that returns true
if the exception should be logged, false
otherwiseErrorLogFactory
to be used in
HttpServer.errorLog(boolean, ErrorLogFactory)
static ErrorLogFactory createFilter(Predicate<ErrorLogArgProvider> predicate, ErrorLogFactory formatFunction)
Any exception (represented as an ErrorLogArgProvider
) that doesn't match the
provided Predicate
is excluded from the error log. Other exceptions are logged
using the provided formatting Function
.
Create an ErrorLog
instance by defining both the String format and a vararg of the relevant arguments,
extracted from the ErrorLogArgProvider
.
predicate
- the filter that returns true
if the exception should be logged, false
otherwiseformatFunction
- the ErrorLogFactory
that creates ErrorLog
instances, encapsulating the
format and the extraction of relevant argumentsErrorLogFactory
to be used in
HttpServer.errorLog(boolean, ErrorLogFactory)