3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

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