aboutsummaryrefslogtreecommitdiff
path: root/spark-velocity/src/main/java/me
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2021-11-01 20:45:46 +0000
committerLuck <git@lucko.me>2021-11-01 20:46:16 +0000
commitfe578229bf7e77b522eda8737374c2f26b30c24b (patch)
tree467b78fbbccb801788194f6a6e586963458f41d8 /spark-velocity/src/main/java/me
parent8ebf2d39a1d95c409d2151374b8ff1ad9e776d97 (diff)
downloadspark-fe578229bf7e77b522eda8737374c2f26b30c24b.tar.gz
spark-fe578229bf7e77b522eda8737374c2f26b30c24b.tar.bz2
spark-fe578229bf7e77b522eda8737374c2f26b30c24b.zip
async-profiler on macos
Diffstat (limited to 'spark-velocity/src/main/java/me')
-rw-r--r--spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java
index 40c470f..698aab0 100644
--- a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java
+++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java
@@ -35,8 +35,11 @@ import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.platform.PlatformInfo;
import me.lucko.spark.common.util.ClassSourceLookup;
+import org.slf4j.Logger;
+
import java.nio.file.Path;
import java.util.List;
+import java.util.logging.Level;
import java.util.stream.Stream;
@Plugin(
@@ -49,13 +52,15 @@ import java.util.stream.Stream;
public class VelocitySparkPlugin implements SparkPlugin, SimpleCommand {
private final ProxyServer proxy;
+ private final Logger logger;
private final Path configDirectory;
private SparkPlatform platform;
@Inject
- public VelocitySparkPlugin(ProxyServer proxy, @DataDirectory Path configDirectory) {
+ public VelocitySparkPlugin(ProxyServer proxy, Logger logger, @DataDirectory Path configDirectory) {
this.proxy = proxy;
+ this.logger = logger;
this.configDirectory = configDirectory;
}
@@ -110,6 +115,19 @@ public class VelocitySparkPlugin implements SparkPlugin, SimpleCommand {
}
@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 ClassSourceLookup createClassSourceLookup() {
return new VelocityClassSourceLookup(this.proxy.getPluginManager());
}