Class ValidationResultLogger

java.lang.Object
org.projecthusky.fhir.emed.ch.epr.validator.ValidationResultLogger

public class ValidationResultLogger extends Object
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.
  • Field Details

  • 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

      public void addFilter(Predicate<@NonNull ValidationIssue> filter)
      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

      public void setFilters(List<@NonNull Predicate<@NonNull ValidationIssue>> filters)
      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

      protected void logValidationResult(ValidationResult validationResult)
      Logs the validation result.
      Parameters:
      validationResult - The validation result to be logged.
    • logAtLevel

      protected void logAtLevel(org.slf4j.event.Level level, String message)
      Logs a message at the specified level.
      Parameters:
      level - The level at which to log the message.
      message - The message to be logged.