geforkt von Mirrors/Paper
Add ConsoleLogFormatter for diff visibility
Dieser Commit ist enthalten in:
Ursprung
31d488a386
Commit
e91169ebad
51
src/main/java/net/minecraft/server/ConsoleLogFormatter.java
Normale Datei
51
src/main/java/net/minecraft/server/ConsoleLogFormatter.java
Normale Datei
@ -0,0 +1,51 @@
|
|||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.logging.Formatter;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.LogRecord;
|
||||||
|
|
||||||
|
final class ConsoleLogFormatter extends Formatter {
|
||||||
|
|
||||||
|
private SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
ConsoleLogFormatter() {}
|
||||||
|
|
||||||
|
public String format(LogRecord logrecord) {
|
||||||
|
StringBuilder stringbuilder = new StringBuilder();
|
||||||
|
|
||||||
|
stringbuilder.append(this.a.format(Long.valueOf(logrecord.getMillis())));
|
||||||
|
Level level = logrecord.getLevel();
|
||||||
|
|
||||||
|
if (level == Level.FINEST) {
|
||||||
|
stringbuilder.append(" [FINEST] ");
|
||||||
|
} else if (level == Level.FINER) {
|
||||||
|
stringbuilder.append(" [FINER] ");
|
||||||
|
} else if (level == Level.FINE) {
|
||||||
|
stringbuilder.append(" [FINE] ");
|
||||||
|
} else if (level == Level.INFO) {
|
||||||
|
stringbuilder.append(" [INFO] ");
|
||||||
|
} else if (level == Level.WARNING) {
|
||||||
|
stringbuilder.append(" [WARNING] ");
|
||||||
|
} else if (level == Level.SEVERE) {
|
||||||
|
stringbuilder.append(" [SEVERE] ");
|
||||||
|
} else if (level == Level.SEVERE) {
|
||||||
|
stringbuilder.append(" [" + level.getLocalizedName() + "] ");
|
||||||
|
}
|
||||||
|
|
||||||
|
stringbuilder.append(logrecord.getMessage());
|
||||||
|
stringbuilder.append('\n');
|
||||||
|
Throwable throwable = logrecord.getThrown();
|
||||||
|
|
||||||
|
if (throwable != null) {
|
||||||
|
StringWriter stringwriter = new StringWriter();
|
||||||
|
|
||||||
|
throwable.printStackTrace(new PrintWriter(stringwriter));
|
||||||
|
stringbuilder.append(stringwriter.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringbuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren