Skip to content

Commit

Permalink
refactor: Another small improvement to extension logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
peacekeeper committed Aug 15, 2023
1 parent de2517b commit c9812e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private <E extends DereferencerExtension> void executeExtensions(Class<E> extens
String extensionStage = extensionClass.getAnnotation(DereferencerExtension.ExtensionStage.class).value();

List<E> extensions = this.getExtensions().stream().filter(extensionClass::isInstance).map(extensionClass::cast).toList();
if (log.isDebugEnabled()) log.debug("For extension stage '" + extensionStage + "' trying the following extensions: " + DereferencerExtension.extensionClassNames(extensions));
if (log.isDebugEnabled()) log.debug("EXTENSIONS (" + extensionStage + "), TRYING: {}", DereferencerExtension.extensionClassNames(extensions));

List<DereferencerExtension> skippedExtensions = new ArrayList<>();
List<DereferencerExtension> inapplicableExtensions = new ArrayList<>();
Expand All @@ -192,7 +192,10 @@ private <E extends DereferencerExtension> void executeExtensions(Class<E> extens
if (log.isDebugEnabled()) log.debug("Executed extension (" + extensionStage + ") " + extension.getClass().getSimpleName() + " with dereference options " + changedDereferenceOptions + " and dereference result " + changedDereferenceResult + " and execution state " + changedExecutionState);
}

if (log.isDebugEnabled()) log.debug("Skipped extensions (" + extensionStage + "): {}, inapplicable extensions (" + extensionStage + "): {}", DereferencerExtension.extensionClassNames(skippedExtensions), DereferencerExtension.extensionClassNames(inapplicableExtensions));
if (log.isDebugEnabled()) {
List<E> executedExtensions = extensions.stream().filter(e -> ! skippedExtensions.contains(e)).filter(e -> ! inapplicableExtensions.contains(e)).toList();
log.debug("EXTENSIONS (" + extensionStage + "), EXECUTED: {}, SKIPPED: {}, INAPPLICABLE: {}", DereferencerExtension.extensionClassNames(executedExtensions), DereferencerExtension.extensionClassNames(skippedExtensions), DereferencerExtension.extensionClassNames(inapplicableExtensions));
}
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private <E extends ResolverExtension> void executeExtensions(Class<E> extensionC
String extensionStage = extensionClass.getAnnotation(ResolverExtension.ExtensionStage.class).value();

List<E> extensions = this.getExtensions().stream().filter(extensionClass::isInstance).map(extensionClass::cast).toList();
if (log.isDebugEnabled()) log.debug("For extension stage '" + extensionStage + "' trying the following extensions: " + ResolverExtension.extensionClassNames(extensions));
if (log.isDebugEnabled()) log.debug("EXTENSIONS (" + extensionStage + "), TRYING: {}", ResolverExtension.extensionClassNames(extensions));

List<ResolverExtension> skippedExtensions = new ArrayList<>();
List<ResolverExtension> inapplicableExtensions = new ArrayList<>();
Expand All @@ -220,7 +220,10 @@ private <E extends ResolverExtension> void executeExtensions(Class<E> extensionC
if (log.isDebugEnabled()) log.debug("Executed extension (" + extensionStage + ") " + extension.getClass().getSimpleName() + " with resolution options " + changedResolutionOptions + " and resolve result " + changedResolveResult + " and execution state " + changedExecutionState);
}

if (log.isDebugEnabled()) log.debug("Skipped extensions (" + extensionStage + "): {}, inapplicable extensions (" + extensionStage + "): {}", ResolverExtension.extensionClassNames(skippedExtensions), ResolverExtension.extensionClassNames(inapplicableExtensions));
if (log.isDebugEnabled()) {
List<E> executedExtensions = extensions.stream().filter(e -> ! skippedExtensions.contains(e)).filter(e -> ! inapplicableExtensions.contains(e)).toList();
log.debug("EXTENSIONS (" + extensionStage + "), EXECUTED: {}, SKIPPED: {}, INAPPLICABLE: {}", ResolverExtension.extensionClassNames(executedExtensions), ResolverExtension.extensionClassNames(skippedExtensions), ResolverExtension.extensionClassNames(inapplicableExtensions));
}
}

@Override
Expand Down

0 comments on commit c9812e1

Please sign in to comment.