aboutsummaryrefslogtreecommitdiff
path: root/spark-velocity4/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'spark-velocity4/src/main/java')
-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());
}