From 59674ed29c6b2c7e8ac98fc4f0f4fd4fd6d437c9 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 24 Apr 2020 13:10:00 +0800 Subject: Implemented uniformed console output (log4j) in PrintUtil. --- .../java/com/keuin/kbackupfabric/util/PrintUtil.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/com/keuin/kbackupfabric/util') diff --git a/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java b/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java index fe98cfa..ca00ad4 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java +++ b/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java @@ -6,6 +6,9 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + public final class PrintUtil { @@ -15,6 +18,7 @@ public final class PrintUtil { private static final Style warnStyle = new Style().setColor(Formatting.YELLOW); private static final Style errorStyle = new Style().setColor(Formatting.DARK_RED); + private static final Logger LOGGER = LogManager.getLogger(); public static CommandContext msgInfo(CommandContext context, String messageText) { return msgInfo(context, messageText, false); @@ -48,4 +52,20 @@ public final class PrintUtil { } return context; } + + public static void debug(String string) { + LOGGER.debug("[KBackup] " + string); + } + + public static void info(String string) { + LOGGER.info("[KBackup] " + string); + } + + public static void warn(String string) { + LOGGER.warn("[KBackup] " + string); + } + + public static void error(String string) { + LOGGER.error("[KBackup] " + string); + } } -- cgit v1.2.3