aboutsummaryrefslogtreecommitdiff
path: root/spark-velocity4/src/main/java/me/lucko/spark
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-velocity4/src/main/java/me/lucko/spark
parent8ebf2d39a1d95c409d2151374b8ff1ad9e776d97 (diff)
downloadspark-fe578229bf7e77b522eda8737374c2f26b30c24b.tar.gz
spark-fe578229bf7e77b522eda8737374c2f26b30c24b.tar.bz2
spark-fe578229bf7e77b522eda8737374c2f26b30c24b.zip
async-profiler on macos
Diffstat (limited to 'spark-velocity4/src/main/java/me/lucko/spark')
-rw-r--r--spark-velocity4/src/main/java/me/lucko/spark/velocity/Velocity4SparkPlugin.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/spark-velocity4/src/main/java/me/lucko/spark/velocity/Velocity4SparkPlugin.java b/spark-velocity4/src/main/java/me/lucko/spark/velocity/Velocity4SparkPlugin.java
index 072f5c7..e1acd57 100644
--- a/spark-velocity4/src/main/java/me/lucko/spark/velocity/Velocity4SparkPlugin.java
+++ b/spark-velocity4/src/main/java/me/lucko/spark/velocity/Velocity4SparkPlugin.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 Velocity4SparkPlugin implements SparkPlugin, SimpleCommand {
private final ProxyServer proxy;
+ private final Logger logger;
private final Path configDirectory;
private SparkPlatform platform;
@Inject
- public Velocity4SparkPlugin(ProxyServer proxy, @DataDirectory Path configDirectory) {
+ public Velocity4SparkPlugin(ProxyServer proxy, Logger logger, @DataDirectory Path configDirectory) {
this.proxy = proxy;
+ this.logger = logger;
this.configDirectory = configDirectory;
}
@@ -110,6 +115,19 @@ public class Velocity4SparkPlugin 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 Velocity4ClassSourceLookup(this.proxy.pluginManager());
}