13
0
geforkt von Mirrors/Velocity

Add startup time to log messages

Dieser Commit ist enthalten in:
MatrixTunnel 2018-08-13 00:44:55 -07:00
Ursprung bb489c5574
Commit dbe207d0c2

Datei anzeigen

@ -4,9 +4,15 @@ import com.velocitypowered.proxy.console.VelocityConsole;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class Velocity {
private static final Logger logger = LogManager.getLogger(Velocity.class);
private static long startTime;
static {
// We use BufferedImage for favicons, and on macOS this puts the Java application in the dock. How inconvenient.
// Force AWT to work with its head chopped off.
@ -14,12 +20,15 @@ public class Velocity {
}
public static void main(String... args) {
startTime = System.currentTimeMillis();
logger.info("Booting up Velocity...");
final VelocityServer server = VelocityServer.getServer();
server.start();
Runtime.getRuntime().addShutdownHook(new Thread(server::shutdown, "Shutdown thread"));
logger.info("Done ({}s)!", new SimpleDateFormat("ss.S", Locale.getDefault()).format(new Date(System.currentTimeMillis() - startTime)));
new VelocityConsole(server).start();
}
}