Logging cleanup

This commit is contained in:
Stef Tervelde
2025-02-06 22:47:58 +01:00
parent 3cd158a653
commit 00c57607d1
10 changed files with 320 additions and 39 deletions
@@ -287,7 +287,7 @@ public class CompletionPanel {
int x = ta.getCaretPosition() - ta.getLineStartOffset(line) - 1, x1 = x - 1;
if (x >= s.length() || x < 0)
return null; //TODO: Does this check cause problems? Verify.
if (Base.DEBUG) System.out.print(" x char: " + s.charAt(x));
Messages.log(" x char: " + s.charAt(x));
String word = String.valueOf(s.charAt(x));
if (s.trim().length() == 1) {
@@ -117,7 +117,7 @@ public class PreprocService {
running = true;
PreprocSketch prevResult = null;
CompletableFuture<?> runningCallbacks = null;
Messages.log("PPS: Hi!");
Messages.log("Hi!");
while (running) {
try {
try {
@@ -127,7 +127,7 @@ public class PreprocService {
break;
}
Messages.log("PPS: Starting");
Messages.log("Starting");
prevResult = preprocessSketch(prevResult);
@@ -143,7 +143,7 @@ public class PreprocService {
synchronized (requestLock) {
if (requestQueue.isEmpty()) {
runningCallbacks = lastCallback;
Messages.log("PPS: Done");
Messages.log("Done");
preprocessingTask.complete(prevResult);
}
}
@@ -151,7 +151,7 @@ public class PreprocService {
Messages.err("problem in preprocessor service loop", e);
}
}
Messages.log("PPS: Bye!");
Messages.log("Bye!");
}
/**
@@ -188,7 +188,7 @@ public class PreprocService {
* Indicate to this service that the sketch libraries have changed.
*/
public void notifyLibrariesChanged() {
Messages.log("PPS: notified libraries changed");
Messages.log("notified libraries changed");
librariesChanged.set(true);
notifySketchChanged();
}
@@ -197,7 +197,7 @@ public class PreprocService {
* Indicate to this service that the folder housing sketch code has changed.
*/
public void notifyCodeFolderChanged() {
Messages.log("PPS: notified code folder changed");
Messages.log("notified code folder changed");
codeFolderChanged.set(true);
notifySketchChanged();
}
@@ -216,7 +216,7 @@ public class PreprocService {
.thenAcceptBothAsync(lastCallback, (ps, a) -> callback.accept(ps))
// Make sure exception in callback won't cancel whole callback chain
.handleAsync((res, e) -> {
if (e != null) Messages.err("PPS: exception in callback", e);
if (e != null) Messages.err("exception in callback", e);
return res;
});
return lastCallback;
@@ -253,19 +253,19 @@ public class Runner implements MessageConsumer {
// while (!available) {
while (true) {
try {
Messages.log(getClass().getName() + " attempting to attach to VM");
Messages.log("attempting to attach to VM");
synchronized (cancelLock) {
vm = connector.attach(arguments);
if (cancelled && vm != null) {
// cancelled and connected to the VM, handle closing now
Messages.log(getClass().getName() + " aborting, launch cancelled");
Messages.log("aborting, launch cancelled");
close();
return false;
}
}
// vm = connector.attach(arguments);
if (vm != null) {
Messages.log(getClass().getName() + " attached to the VM");
Messages.log("attached to the VM");
// generateTrace();
// available = true;
return true;
@@ -273,17 +273,17 @@ public class Runner implements MessageConsumer {
} catch (ConnectException ce) {
// This will fire ConnectException (socket not available) until
// the VM finishes starting up and opens its socket for us.
Messages.log(getClass().getName() + " socket for VM not ready");
Messages.log("socket for VM not ready");
// System.out.println("waiting");
// e.printStackTrace();
try {
Thread.sleep(100);
} catch (InterruptedException ie) {
Messages.err(getClass().getName() + " interrupted", ie);
Messages.err("interrupted", ie);
// ie.printStackTrace(sketchErr);
}
} catch (IOException e) {
Messages.err(getClass().getName() + " while attaching to VM", e);
Messages.err("while attaching to VM", e);
}
}
// } catch (IOException exc) {