Skip to content

Commit 0917c7d

Browse files
committed
fix logging script running
1 parent dc447f9 commit 0917c7d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public void run(LoadStage currentLoadStage) {
167167

168168
@Override
169169
protected void runScript(Script script) {
170+
GroovyLog.get().info(" - running {}", script.getClass().getName());
170171
securityManager.install();
171172
super.runScript(script);
172173
securityManager.uninstall();
@@ -253,14 +254,12 @@ protected Class<?> loadScriptClass(GroovyScriptEngine engine, File file) {
253254
if (comp != null && lastModified <= comp.lastEdited && comp.clazz == null && comp.readData(this.cacheRoot.getPath())) {
254255
// class is not loaded, but the cached class bytes are still valid
255256
if (!comp.checkPreprocessors(this.scriptRoot)) {
256-
return GroovyLog.class;
257+
return GroovyLog.class; // failed preprocessor check
257258
}
258-
GroovyLog.get().debugMC(" script {} is already compiled", relativeFile);
259259
comp.ensureLoaded(engine.getGroovyClassLoader(), this.cacheRoot.getPath());
260260

261261
} else if (comp == null || comp.clazz == null || lastModified > comp.lastEdited) {
262262
// class is not loaded and class bytes don't exist yet or script has been edited
263-
GroovyLog.get().debugMC(" compiling script {}", relativeFile);
264263
if (comp == null) {
265264
comp = new CompiledScript(relativeFile.toString(), 0);
266265
this.index.put(relativeFile.toString(), comp);
@@ -275,20 +274,19 @@ protected Class<?> loadScriptClass(GroovyScriptEngine engine, File file) {
275274
comp.deleteCache(this.cacheRoot.getPath());
276275
comp.clazz = null;
277276
comp.data = null;
278-
return GroovyLog.class;
277+
return GroovyLog.class; // failed preprocessor check
279278
}
280279
Class<?> clazz = super.loadScriptClass(engine, relativeFile);
281280
if (comp.clazz == null) {
282281
// should not happen
283-
GroovyLog.get().debugMC("Class for {} was loaded, but didnt receive class created callback! Index: {}", relativeFile, this.index);
282+
GroovyLog.get().errorMC("Class for {} was loaded, but didn't receive class created callback! Index: {}", relativeFile, this.index);
284283
comp.clazz = clazz;
285284
}
286285
} else {
287286
// class is loaded and script wasn't edited
288287
if (!comp.checkPreprocessors(this.scriptRoot)) {
289-
return GroovyLog.class;
288+
return GroovyLog.class; // failed preprocessor check
290289
}
291-
GroovyLog.get().debugMC(" script {} is already compiled and loaded", relativeFile);
292290
comp.ensureLoaded(engine.getGroovyClassLoader(), this.cacheRoot.getPath());
293291
}
294292
return comp.clazz;

0 commit comments

Comments
 (0)