Skip to content

Commit

Permalink
Add the constraint id to the console message if the finding has an as…
Browse files Browse the repository at this point in the history
…sociated id. (metaschema-framework#181)
  • Loading branch information
david-waltermire authored Oct 19, 2024
1 parent 785baef commit 8d850e2
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public static LoggingValidationHandler instance() {
* Get a singleton instance of the logging validation handler.
*
* @param logExceptions
* {@code true} if this instance will log exceptions or {@code false}
* otherwise
* {@code true} if this instance will log exceptions or {@code false} otherwise
* @return the instance
*/
@SuppressFBWarnings(value = "SING_SINGLETON_GETTER_NOT_SYNCHRONIZED",
Expand Down Expand Up @@ -148,8 +147,15 @@ private void handleXmlValidationFinding(XmlValidationFinding finding) {
private void handleConstraintValidationFinding(@NonNull ConstraintValidationFinding finding) {
Ansi ansi = generatePreamble(finding.getSeverity());

ansi.format("[%s]", finding.getTarget().getMetapath());

String id = finding.getIdentifier();
if (id != null) {
ansi.format(" %s: ", id);
}

getLogger(finding).log(
ansi.format("[%s] %s", finding.getTarget().getMetapath(), finding.getMessage()));
ansi.format(" %s", finding.getTarget().getMetapath(), finding.getMessage()));
}

@NonNull
Expand Down

0 comments on commit 8d850e2

Please sign in to comment.