From 86d56840473d8e071530164bd4ae52598246283b Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 27 Oct 2022 20:35:43 +0200 Subject: [PATCH] feat: increase logging for refactorings --- .../spoon/code_solver/RepeatingProcessingManager.java | 5 +++++ .../xyz/keksdose/spoon/code_solver/TransformationEngine.java | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/RepeatingProcessingManager.java b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/RepeatingProcessingManager.java index c59e2394c..d74944862 100644 --- a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/RepeatingProcessingManager.java +++ b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/RepeatingProcessingManager.java @@ -1,5 +1,6 @@ package xyz.keksdose.spoon.code_solver; +import com.google.common.flogger.FluentLogger; import java.util.Collection; import spoon.reflect.declaration.CtElement; import spoon.reflect.factory.Factory; @@ -13,7 +14,9 @@ */ public class RepeatingProcessingManager extends QueueProcessingManager { + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private final ChangeListener listener; + private int iteration = 0; public RepeatingProcessingManager(Factory factory, ChangeListener listener) { super(factory); @@ -24,7 +27,9 @@ public RepeatingProcessingManager(Factory factory, ChangeListener listener) { public void process(Collection elements) { do { listener.reset(); + logger.atInfo().log("Starting iteration %d", iteration++); super.process(elements); + logger.atInfo().log("Finished iteration %d", iteration); } while (listener.isChanged()); } } diff --git a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/TransformationEngine.java b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/TransformationEngine.java index 3f1969eed..829d162ce 100644 --- a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/TransformationEngine.java +++ b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/TransformationEngine.java @@ -69,11 +69,12 @@ public TransformationEngine setPrinting(IPrinting printing) { } public Changelog applyToGivenPath(String path) { - LOGGER.atInfo().log("Applying transformations to %s", path); + LOGGER.atInfo().log("Applying transformations to %s with %s processors", path, processors.size()); Launcher launcher = new Launcher(); Environment environment = EnvironmentOptions.setEnvironmentOptions(launcher); addInput(path, launcher); CtModel model = launcher.buildModel(); + LOGGER.atInfo().log("Model built"); PrinterCreation.setPrettyPrinter(environment, model); if (printing == null) { printing = new ChangedTypePrinting(environment.createPrettyPrinter()); @@ -101,7 +102,7 @@ private void addProcessors(ProcessingManager pm, ChangeListener listener) { } public Changelog applyToGivenPath(String path, String typeName) { - LOGGER.atInfo().log("Applying transformations to %s", path); + LOGGER.atInfo().log("Applying transformations to %s with %s processors", path, processors.size()); Launcher launcher = new Launcher(); Environment environment = EnvironmentOptions.setEnvironmentOptions(launcher); addInput(path, launcher);