improved logging in windows

This commit is contained in:
Lukas-Heiligenbrunner 2019-11-11 13:07:56 +01:00 committed by GitHub
parent 797d29281b
commit 98e14b92ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,9 @@ public class Log {
public static void log(String msg, int level) {
boolean iswindows = System.getProperty("os.name").contains("Windows");
StringBuilder builder = new StringBuilder();
if (!iswindows){
switch (level) {
case INFO:
builder.append(ANSI_CYAN);
@ -73,6 +75,8 @@ public class Log {
builder.append(ANSI_BLUE);
break;
}
}
builder.append("[");
builder.append(calcDate(System.currentTimeMillis()));
builder.append("]");
@ -85,11 +89,16 @@ public class Log {
builder.append(colors.get(level));
builder.append("]");
builder.append(ANSI_WHITE);
if (!iswindows){
builder.append(ANSI_WHITE);
}
builder.append(" - ");
builder.append(msg);
builder.append(ANSI_RESET);
if (!iswindows){
builder.append(ANSI_RESET);
}
System.out.println(builder.toString());
}