diff --git a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/WarpCoreSpeedMonitor.java b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/WarpCoreSpeedMonitor.java index 6f839de..45051c8 100644 --- a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/WarpCoreSpeedMonitor.java +++ b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/WarpCoreSpeedMonitor.java @@ -27,6 +27,8 @@ package love.distributedrebirth.nx01.warp.core; +import java.util.Objects; +import java.util.logging.Level; import java.util.logging.Logger; import love.distributedrebirth.nx01.warp.core.react.WarpReact; @@ -44,17 +46,35 @@ public class WarpCoreSpeedMonitor implements WarpReactTypeScript { public static final WarpReactPlasma API = WarpReactPlasma.ofClass(WarpCoreSpeedMonitor.class); private static final WarpReactPlasma API_DILITHIUM = WarpCoreReactor.DILITHIUM; private static final Logger LOG = Logger.getLogger(WarpCoreSpeedMonitor.class.getName()); - + private Level level = Level.FINE; + @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); react.claim(API); react.requireSlot(API, API_DILITHIUM); react.registrate(API_DILITHIUM, WarpSpacePlasmaAdd.class, v -> { - LOG.fine("slot-add: " + v.getData().getSlot().getSlotPath()); + LOG.log(level, "slot-add: " + v.getData().getSlot().getSlotPath()); }); react.registrate(API_DILITHIUM, WarpSpacePlasmaRemove.class, v -> { - LOG.fine("slot-remove: " + v.getData().getSlot().getSlotPath()); + LOG.log(level, "slot-remove: " + v.getData().getSlot().getSlotPath()); + }); + react.claimIn(API, UpdateLogLevel.class); + react.registrate(API, UpdateLogLevel.class, v -> { + level = v.getData().getLevel(); }); } + + public final class UpdateLogLevel { + + private final Level level; + + public UpdateLogLevel(Level level) { + this.level = Objects.requireNonNull(level); + } + + public Level getLevel() { + return level; + } + } } diff --git a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java index bcca47c..a040fa5 100644 --- a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java +++ b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java @@ -95,7 +95,7 @@ public final class WarpReactPlasma { } public static WarpReactPlasma ofClassQualified(Class scriptClz, String qualifier) { - return new WarpReactPlasma(null, scriptClz.getPackageName() + ":type=" + scriptClz.getSimpleName() + ":name=" + qualifier); + return new WarpReactPlasma(null, scriptClz.getPackageName() + ":type=" + scriptClz.getSimpleName() + ",name=" + qualifier); } public static WarpReactPlasma ofClass(Class scriptClz) { diff --git a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServerBooted.java b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServerBooted.java index e027075..a40038b 100644 --- a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServerBooted.java +++ b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServerBooted.java @@ -29,7 +29,6 @@ package love.distributedrebirth.nx01.zerofungus.server; import java.util.logging.Logger; -import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; @@ -38,12 +37,10 @@ import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @version ©Δ∞ 仙上主天 public class ZFunRtsServerBooted implements WarpReactTypeScript { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(ZFunRtsServerBooted.class); private static final Logger logger = Logger.getLogger(ZFunRtsServerBooted.class.getName()); @Override public void onEvent(WarpReactPlasmaPulse signal) { - signal.getReact().claim(API); logger.info("╔═╗┌─┐┬─┐┌─┐ .╔═╗┬ ┬┌┐┌╔═╗┬ ┬┌─┐"); logger.info("╔═╝├┤ ├┬┘│ │ . ╠╣ │ ││││║ ╦│ │└─┐"); logger.info("╚═╝└─┘┴└─└─┘. ╚ └─┘┘└┘╚═╝└─┘└─┘");