diff options
author | Luck <git@lucko.me> | 2021-11-01 20:45:46 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2021-11-01 20:46:16 +0000 |
commit | fe578229bf7e77b522eda8737374c2f26b30c24b (patch) | |
tree | 467b78fbbccb801788194f6a6e586963458f41d8 /spark-forge1122/src/main/java/me | |
parent | 8ebf2d39a1d95c409d2151374b8ff1ad9e776d97 (diff) | |
download | spark-fe578229bf7e77b522eda8737374c2f26b30c24b.tar.gz spark-fe578229bf7e77b522eda8737374c2f26b30c24b.tar.bz2 spark-fe578229bf7e77b522eda8737374c2f26b30c24b.zip |
async-profiler on macos
Diffstat (limited to 'spark-forge1122/src/main/java/me')
-rw-r--r-- | spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java index d052d72..727a2fd 100644 --- a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java +++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java @@ -31,23 +31,29 @@ import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import java.nio.file.Path; import java.util.Collections; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import java.util.logging.Level; import javax.annotation.Nullable; public abstract class Forge1122SparkPlugin implements SparkPlugin, ICommand { private final Forge1122SparkMod mod; + private final Logger logger; protected final ScheduledExecutorService scheduler; protected final SparkPlatform platform; protected final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread(); protected Forge1122SparkPlugin(Forge1122SparkMod mod) { this.mod = mod; + this.logger = LogManager.getLogger("spark"); this.scheduler = Executors.newSingleThreadScheduledExecutor(r -> { Thread thread = Executors.defaultThreadFactory().newThread(r); thread.setName("spark-forge-async-worker"); @@ -84,6 +90,19 @@ public abstract class Forge1122SparkPlugin implements SparkPlugin, ICommand { } @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(); } |