Class ValidationResultLogger
java.lang.Object
org.projecthusky.fhir.emed.ch.epr.validator.ValidationResultLogger
A logger class for validation results. This class allows for clients to specify issue filters and an issue severity
to logging level mapping to further refine logging.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionValidationResultLogger(org.slf4j.Logger log) Creates a validation result logger that will use the received SLF4J logger to do so.ValidationResultLogger(org.slf4j.Logger log, List<@NonNull Predicate<@NonNull ValidationIssue>> filters, Function<@Nullable org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity, org.slf4j.event.Level> severityMapper) Creates a validation result logger that will use the received SLF4J logger to do so. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFilter(Predicate<@NonNull ValidationIssue> filter) Adds a filter to the list of issue filters.static Function<@Nullable org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity, org.slf4j.event.Level> protected voidlogAtLevel(org.slf4j.event.Level level, String message) Logs a message at the specified level.protected voidlogValidationResult(ValidationResult validationResult) Logs the validation result.voidsetFilters(List<@NonNull Predicate<@NonNull ValidationIssue>> filters) Sets the list of filters to be applied to the list of validation issues before being logged.
-
Field Details
-
DEFAULT_SEVERITY_MAPPER
-
-
Constructor Details
-
ValidationResultLogger
public ValidationResultLogger(org.slf4j.Logger log) Creates a validation result logger that will use the received SLF4J logger to do so.By default, this logger will use a no-op filtering (i.e. no filtering) and a
ValidationResultLogger.DefaultSeverityMapper.- Parameters:
log- The SLF4J logger to be used to log the validation issues messages.
-
ValidationResultLogger
public ValidationResultLogger(org.slf4j.Logger log, List<@NonNull Predicate<@NonNull ValidationIssue>> filters, Function<@Nullable org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity, org.slf4j.event.Level> severityMapper) Creates a validation result logger that will use the received SLF4J logger to do so.- Parameters:
log- The SLF4J logger to be used to log the validation issues messages.filters- The list of predicates to be used to filter out issues that should not be logged.severityMapper- The severity mapper between the validation issues severity and the logging level.
-
-
Method Details
-
getDefaultSeverityMapper
public static Function<@Nullable org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity,org.slf4j.event.Level> getDefaultSeverityMapper() -
addFilter
Adds a filter to the list of issue filters.- Parameters:
filter- The filter to be applied. Note that if the result of applying the predicate is true, the issue will be logged.
-
setFilters
Sets the list of filters to be applied to the list of validation issues before being logged.- Parameters:
filters- The list of filters to be applied.
-
logValidationResult
Logs the validation result.- Parameters:
validationResult- The validation result to be logged.
-
logAtLevel
Logs a message at the specified level.- Parameters:
level- The level at which to log the message.message- The message to be logged.
-