Skip to content

Commit 605d5bb

Browse files
committed
Improve runtime log pattern and milestone color in run console
1 parent ec7e23e commit 605d5bb

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

editor/src/main/java/com/jvn/editor/ui/RunConsoleView.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public interface ProcessStarter {
138138
Pattern.CASE_INSENSITIVE
139139
);
140140
private static final Pattern RUNTIME_LOG_LINE = Pattern.compile(
141-
"^\\d{2}:\\d{2}:\\d{2}\\.\\d{3}\\s+(TRACE|DEBUG|INFO|WARN|ERROR)\\s+\\[[^\\]]+\\]\\s+.+?\\s+-\\s+.+$",
141+
"^\\d{2}:\\d{2}:\\d{2}[.,]\\d{3}\\s+\\|?-?(TRACE|DEBUG|INFO|WARN|ERROR)\\b",
142142
Pattern.CASE_INSENSITIVE
143143
);
144144

@@ -403,13 +403,19 @@ private void scrollToBottom() {
403403
}
404404

405405
private static String classifyLine(String line) {
406-
if (line.startsWith("\u200B")) return "run-console-line-milestone";
406+
if (line.startsWith("\u200B")) return "run-console-line-milestone";
407+
java.util.regex.Matcher rtm = RUNTIME_LOG_LINE.matcher(line);
408+
if (rtm.find()) {
409+
String level = rtm.group(1).toUpperCase();
410+
return switch (level) {
411+
case "ERROR" -> "run-console-line-error";
412+
case "WARN" -> "run-console-line-warn";
413+
case "INFO" -> "run-console-line-info";
414+
default -> "run-console-line-engine";
415+
};
416+
}
407417
if (ERROR_LINE.matcher(line).find()) return "run-console-line-error";
408418
if (WARN_LINE.matcher(line).find()) return "run-console-line-warn";
409-
if (RUNTIME_LOG_LINE.matcher(line).find()) {
410-
if (line.toUpperCase().contains(" INFO ")) return "run-console-line-info";
411-
return "run-console-line-engine";
412-
}
413419
if (ENGINE_MSG.matcher(line).find()) return "run-console-line-engine";
414420
if (GRADLE_NOISE.matcher(line).find()) return "run-console-line-noise";
415421
return "run-console-line-normal";

editor/src/main/resources/com/jvn/editor/editor.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
}
277277

278278
.run-console-line-milestone {
279-
-fx-text-fill: #e8d8ad;
279+
-fx-text-fill: #8bcf98;
280280
-fx-font-weight: bold;
281281
}
282282

0 commit comments

Comments
 (0)