Interface ErrorLogFactory
- All Superinterfaces:
Function<ErrorLogArgProvider,
@Nullable ErrorLog>
An interface to declare more concisely a
Function
that apply an ErrorLog
by an
ErrorLogArgProvider
.
Can be used in errorLog
method for example.
- Since:
- 1.2.6
- Author:
- raccoonback
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic 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.
-
Method Details
-
createFilter
Helper method to create an error log factory that selectively enables error logs.Any exception (represented as an
ErrorLogArgProvider
) that doesn't match the providedPredicate
is excluded from the error log. Other exceptions are logged using the default format.- Parameters:
predicate
- the filter that returnstrue
if the exception should be logged,false
otherwise- Returns:
- an
ErrorLogFactory
to be used inHttpServer.errorLog(boolean, ErrorLogFactory)
-
createFilter
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.Any exception (represented as an
ErrorLogArgProvider
) that doesn't match the providedPredicate
is excluded from the error log. Other exceptions are logged using the provided formattingFunction
. Create anErrorLog
instance by defining both the String format and a vararg of the relevant arguments, extracted from theErrorLogArgProvider
.- Parameters:
predicate
- the filter that returnstrue
if the exception should be logged,false
otherwiseformatFunction
- theErrorLogFactory
that createsErrorLog
instances, encapsulating the format and the extraction of relevant arguments- Returns:
- an
ErrorLogFactory
to be used inHttpServer.errorLog(boolean, ErrorLogFactory)
-