aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'spark-fabric/src/main')
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
index a55d161..4bcfce4 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
@@ -40,20 +40,26 @@ import me.lucko.spark.fabric.FabricSparkMod;
import net.minecraft.server.command.CommandOutput;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
+import java.util.logging.Level;
public abstract class FabricSparkPlugin implements SparkPlugin {
private final FabricSparkMod mod;
+ private final Logger logger;
protected final ScheduledExecutorService scheduler;
protected final SparkPlatform platform;
protected final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread();
protected FabricSparkPlugin(FabricSparkMod mod) {
this.mod = mod;
+ this.logger = LogManager.getLogger("spark");
this.scheduler = Executors.newSingleThreadScheduledExecutor(r -> {
Thread thread = Executors.defaultThreadFactory().newThread(r);
thread.setName("spark-fabric-async-worker");
@@ -90,6 +96,19 @@ public abstract class FabricSparkPlugin implements SparkPlugin {
}
@Override
+ public void log(Level level, String msg) {
+ if (level == Level.INFO) {
+ this.logger.info(msg);
+ } else if (level == Level.WARNING) {
+ this.logger.warn(msg);
+ } else if (level == Level.SEVERE) {
+ this.logger.error(msg);
+ } else {
+ throw new IllegalArgumentException(level.getName());
+ }
+ }
+
+ @Override
public ThreadDumper getDefaultThreadDumper() {
return this.threadDumper.get();
}