summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2020-04-23 23:27:33 +0800
committerkeuin <[email protected]>2020-04-23 23:27:33 +0800
commitc0b2237a12fc878ede8a8bbd48c9b4afa8290016 (patch)
tree2dfdea3defb57b7974e4b8c4d6e14bd376fcaafd /src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
parent36451c24439b6fc0a407b3aae12048125539f8d5 (diff)
Split Log4j
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java15
1 files changed, 9 insertions, 6 deletions
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()) {