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 ErrorLogFactorycreateFilter(Predicate<ErrorLogArgProvider> predicate) Helper method to create an error log factory that selectively enables error logs.static ErrorLogFactorycreateFilter(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 providedPredicateis excluded from the error log. Other exceptions are logged using the default format.- Parameters:
predicate- the filter that returnstrueif the exception should be logged,falseotherwise- Returns:
- an
ErrorLogFactoryto 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 providedPredicateis excluded from the error log. Other exceptions are logged using the provided formattingFunction. Create anErrorLoginstance by defining both the String format and a vararg of the relevant arguments, extracted from theErrorLogArgProvider.- Parameters:
predicate- the filter that returnstrueif the exception should be logged,falseotherwiseformatFunction- theErrorLogFactorythat createsErrorLoginstances, encapsulating the format and the extraction of relevant arguments- Returns:
- an
ErrorLogFactoryto be used inHttpServer.errorLog(boolean, ErrorLogFactory)
-