mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
update logging
This commit is contained in:
@@ -20,6 +20,9 @@ import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.inject.Injector;
|
||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class ManifestAddon implements BaseAddon {
|
||||
private final AddonManifest manifest;
|
||||
@@ -29,6 +32,8 @@ public class ManifestAddon implements BaseAddon {
|
||||
@Inject
|
||||
private Platform platform;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ManifestAddon.class);
|
||||
|
||||
public ManifestAddon(AddonManifest manifest, List<AddonInitializer> initializers) {
|
||||
this.manifest = manifest;
|
||||
this.initializers = initializers;
|
||||
@@ -46,9 +51,10 @@ public class ManifestAddon implements BaseAddon {
|
||||
Injector<Platform> platformInjector = Injector.get(platform);
|
||||
platformInjector.addExplicitTarget(Platform.class);
|
||||
|
||||
platform.logger().info("Initializing addon " + getID());
|
||||
LOGGER.info("Initializing addon " + getID());
|
||||
|
||||
initializers.forEach(initializer -> {
|
||||
LOGGER.debug("Invoking entry point {}", initializer.getClass());
|
||||
addonInjector.inject(initializer);
|
||||
platformInjector.inject(initializer);
|
||||
initializer.initialize();
|
||||
|
||||
@@ -36,16 +36,18 @@ import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.addon.bootstrap.BootstrapBaseAddon;
|
||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class ManifestAddonLoader implements BootstrapBaseAddon<ManifestAddon> {
|
||||
@Inject
|
||||
private Platform platform;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ManifestAddonLoader.class);
|
||||
|
||||
private static final Version VERSION = Versions.getVersion(1, 0, 0);
|
||||
|
||||
@Override
|
||||
public Iterable<ManifestAddon> loadAddons(Path addonsFolder, ClassLoader parent) {
|
||||
platform.logger().info("Loading addons...");
|
||||
LOGGER.info("Loading addons...");
|
||||
|
||||
ConfigLoader manifestLoader = new ConfigLoader();
|
||||
manifestLoader.registerLoader(Version.class, new VersionLoader())
|
||||
@@ -57,7 +59,7 @@ public class ManifestAddonLoader implements BootstrapBaseAddon<ManifestAddon> {
|
||||
.filter(path -> path.toFile().isFile() && path.toString().endsWith(".jar"))
|
||||
.map(path -> {
|
||||
try {
|
||||
platform.getDebugLogger().info("Loading addon from JAR " + path);
|
||||
LOGGER.debug("Loading addon from JAR {}", path);
|
||||
JarFile jar = new JarFile(path.toFile());
|
||||
|
||||
JarEntry manifestEntry = jar.getJarEntry("terra.addon.yml");
|
||||
@@ -71,7 +73,7 @@ public class ManifestAddonLoader implements BootstrapBaseAddon<ManifestAddon> {
|
||||
new YamlConfiguration(jar.getInputStream(manifestEntry),
|
||||
"terra.addon.yml"));
|
||||
|
||||
platform.logger().info("Loading addon " + manifest.getID());
|
||||
LOGGER.info("Loading addon {}", manifest.getID());
|
||||
|
||||
ManifestAddonClassLoader loader = new ManifestAddonClassLoader(new URL[]{ path.toUri().toURL() },
|
||||
getClass().getClassLoader());
|
||||
|
||||
Reference in New Issue
Block a user