mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
Fix console font coloring
This commit is contained in:
parent
faa806fc9f
commit
5a6c64377a
@ -47,11 +47,13 @@ public enum Level {
|
|||||||
return this.level <= level.level;
|
return this.level <= level.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Pattern MINECRAFT_LOGGER = Pattern.compile("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\] \\[(?<category>[^\\]]+)\\]");
|
public static final Pattern MINECRAFT_LOGGER = Pattern.compile("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\]");
|
||||||
|
public static final Pattern MINECRAFT_LOGGER_CATEGORY = Pattern.compile("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\] \\[(?<category>[^\\]]+)\\]");
|
||||||
public static final String JAVA_SYMBOL = "([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$][a-zA-Z\\d_$]*";
|
public static final String JAVA_SYMBOL = "([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$][a-zA-Z\\d_$]*";
|
||||||
|
|
||||||
public static Level guessLevel(String line, Level preLevel) {
|
public static Level guessLevel(String line, Level preLevel) {
|
||||||
if (line.startsWith("MC:")) line = line.substring("MC:".length());
|
if (line.startsWith("MC:"))
|
||||||
|
line = line.substring("MC:".length());
|
||||||
Level level = preLevel;
|
Level level = preLevel;
|
||||||
Matcher m = MINECRAFT_LOGGER.matcher(line);
|
Matcher m = MINECRAFT_LOGGER.matcher(line);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
@ -80,19 +82,22 @@ public enum Level {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String level2Str = m.group("category");
|
Matcher m2 = MINECRAFT_LOGGER_CATEGORY.matcher(line);
|
||||||
if (null != level2Str)
|
if (m2.find()) {
|
||||||
switch(level2Str) {
|
String level2Str = m2.group("category");
|
||||||
case "STDOUT":
|
if (null != level2Str)
|
||||||
level = INFO;
|
switch (level2Str) {
|
||||||
break;
|
case "STDOUT":
|
||||||
case "STDERR":
|
level = INFO;
|
||||||
level = ERROR;
|
break;
|
||||||
break;
|
case "STDERR":
|
||||||
}
|
level = ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (line.contains("[INFO]") || line.contains("[CONFIG]") || line.contains("[FINE]")
|
if (line.contains("[INFO]") || line.contains("[CONFIG]") || line.contains("[FINE]")
|
||||||
|| line.contains("[FINER]") || line.contains("[FINEST]"))
|
|| line.contains("[FINER]") || line.contains("[FINEST]"))
|
||||||
level = INFO;
|
level = INFO;
|
||||||
if (line.contains("[SEVERE]") || line.contains("[STDERR]"))
|
if (line.contains("[SEVERE]") || line.contains("[STDERR]"))
|
||||||
level = ERROR;
|
level = ERROR;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
11001
|
|
Loading…
x
Reference in New Issue
Block a user