From c0b2237a12fc878ede8a8bbd48c9b4afa8290016 Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 23 Apr 2020 23:27:33 +0800 Subject: Split Log4j --- src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java') diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java index a1ffcad..3b1901e 100644 --- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java +++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java @@ -7,6 +7,8 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.server.ServerStartCallback; import net.fabricmc.fabric.api.registry.CommandRegistry; import net.minecraft.server.MinecraftServer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.io.File; import java.io.FileInputStream; @@ -15,8 +17,6 @@ import java.io.ObjectInputStream; import java.text.SimpleDateFormat; import java.util.Date; -import static com.keuin.kbackupfabric.util.PrintUtil.debug; -import static com.keuin.kbackupfabric.util.PrintUtil.info; import static org.apache.commons.io.FileUtils.forceDelete; /** @@ -24,6 +24,9 @@ import static org.apache.commons.io.FileUtils.forceDelete; * It contains all events, including the init event. */ public final class KBPluginEvents implements ModInitializer, ServerStartCallback { + + private static final Logger LOGGER = LogManager.getLogger(); + @Override public void onInitialize() { System.out.println("KBackup: Binding events and commands ..."); @@ -33,7 +36,7 @@ public final class KBPluginEvents implements ModInitializer, ServerStartCallback @Override public void onStartServer(MinecraftServer server) { - debug("KBackup: Initializing ..."); + LOGGER.debug("KBackup: Initializing ..."); // Update backup suggestion list BackupNameSuggestionProvider.setBackupSaveDirectory(BackupFilesystemUtil.getBackupSaveDirectory(server).getPath()); @@ -52,9 +55,9 @@ public final class KBPluginEvents implements ModInitializer, ServerStartCallback fileInputStream.close(); // Print metadata - info("Recovered from previous backup:"); - info("Backup Name: " + metadata.getBackupName()); - info("Create Time: " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date(metadata.getBackupTime()))); + LOGGER.info("Recovered from previous backup:"); + LOGGER.info("Backup Name: " + metadata.getBackupName()); + LOGGER.info("Create Time: " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date(metadata.getBackupTime()))); // Delete metadata file if (!metadataFile.delete()) { -- cgit v1.2.3