mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-18 16:26:05 -04:00
add STDOUT & STDERR highlight
This commit is contained in:
parent
a8bc4eb352
commit
4fdafecf77
@ -19,17 +19,17 @@ import java.util.jar.JarFile
|
|||||||
import java.util.jar.Pack200
|
import java.util.jar.Pack200
|
||||||
import java.util.zip.GZIPOutputStream
|
import java.util.zip.GZIPOutputStream
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
import java.util.jar.JarOutputStream
|
||||||
|
import java.util.zip.ZipEntry
|
||||||
|
import java.util.zip.ZipFile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "edu.sc.seis.macAppBundle" version "2.1.6"
|
id "edu.sc.seis.macAppBundle" version "2.1.6"
|
||||||
id "me.tatarka.retrolambda" version "3.5.0"
|
id "me.tatarka.retrolambda" version "3.5.0"
|
||||||
id 'edu.sc.seis.launch4j' version '2.3.0'
|
id 'edu.sc.seis.launch4j' version '2.3.0'
|
||||||
|
id "org.jetbrains.kotlin.jvm" version "1.1.2-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
import java.util.jar.JarOutputStream
|
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import java.util.zip.ZipFile
|
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = 'org.jackhuang.hmcl.Main'
|
ext.mainClass = 'org.jackhuang.hmcl.Main'
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "me.tatarka.retrolambda" version "3.5.0"
|
id "me.tatarka.retrolambda" version "3.5.0"
|
||||||
|
id "org.jetbrains.kotlin.jvm" version "1.1.2-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.getenv("BUILD_NUMBER") != null)
|
if (System.getenv("BUILD_NUMBER") != null)
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "me.tatarka.retrolambda" version "3.5.0"
|
id "me.tatarka.retrolambda" version "3.5.0"
|
||||||
|
id "org.jetbrains.kotlin.jvm" version "1.1.2-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.getenv("BUILD_NUMBER") != null)
|
if (System.getenv("BUILD_NUMBER") != null)
|
||||||
|
@ -47,7 +47,7 @@ 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>[^\\]]+)\\]");
|
public static final Pattern MINECRAFT_LOGGER = 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) {
|
||||||
@ -58,26 +58,36 @@ public enum Level {
|
|||||||
String levelStr = m.group("level");
|
String levelStr = m.group("level");
|
||||||
if (null != levelStr)
|
if (null != levelStr)
|
||||||
switch (levelStr) {
|
switch (levelStr) {
|
||||||
case "INFO":
|
case "INFO":
|
||||||
level = INFO;
|
level = INFO;
|
||||||
break;
|
break;
|
||||||
case "WARN":
|
case "WARN":
|
||||||
level = WARN;
|
level = WARN;
|
||||||
break;
|
break;
|
||||||
case "ERROR":
|
case "ERROR":
|
||||||
level = ERROR;
|
level = ERROR;
|
||||||
break;
|
break;
|
||||||
case "FATAL":
|
case "FATAL":
|
||||||
level = FATAL;
|
level = FATAL;
|
||||||
break;
|
break;
|
||||||
case "TRACE":
|
case "TRACE":
|
||||||
level = TRACE;
|
level = TRACE;
|
||||||
break;
|
break;
|
||||||
case "DEBUG":
|
case "DEBUG":
|
||||||
level = DEBUG;
|
level = DEBUG;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
String level2Str = m.group("category");
|
||||||
|
if (null != level2Str)
|
||||||
|
switch(level2Str) {
|
||||||
|
case "STDOUT":
|
||||||
|
level = INFO;
|
||||||
|
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]")
|
||||||
@ -94,10 +104,10 @@ public enum Level {
|
|||||||
return FATAL;
|
return FATAL;
|
||||||
|
|
||||||
if (line.contains("Exception in thread")
|
if (line.contains("Exception in thread")
|
||||||
|| line.matches("\\s+at " + JAVA_SYMBOL)
|
|| line.matches("\\s+at " + JAVA_SYMBOL)
|
||||||
|| line.matches("Caused by: " + JAVA_SYMBOL)
|
|| line.matches("Caused by: " + JAVA_SYMBOL)
|
||||||
|| line.matches("([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$]?[a-zA-Z\\d_$]*(Exception|Error|Throwable)")
|
|| line.matches("([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$]?[a-zA-Z\\d_$]*(Exception|Error|Throwable)")
|
||||||
|| line.matches("... \\d+ more$"))
|
|| line.matches("... \\d+ more$"))
|
||||||
return ERROR;
|
return ERROR;
|
||||||
return preLevel.level < level.level ? preLevel : level;
|
return preLevel.level < level.level ? preLevel : level;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "me.tatarka.retrolambda" version "3.5.0"
|
id "me.tatarka.retrolambda" version "3.5.0"
|
||||||
|
id "org.jetbrains.kotlin.jvm" version "1.1.2-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.getenv("BUILD_NUMBER") != null)
|
if (System.getenv("BUILD_NUMBER") != null)
|
||||||
|
@ -27,6 +27,7 @@ apply plugin: 'maven'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.code.gson:gson:2.2.4' // Apache License 2.0
|
compile 'com.google.code.gson:gson:2.2.4' // Apache License 2.0
|
||||||
|
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
|
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user