mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 23:01:03 +00:00
improve logging
This commit is contained in:
@@ -104,6 +104,7 @@ public class ConfigPack implements LoaderRegistrar {
|
||||
|
||||
|
||||
public ConfigPack(File folder, TerraPlugin main) throws ConfigException {
|
||||
try {
|
||||
this.loader = new FolderLoader(folder.toPath());
|
||||
this.main = main;
|
||||
long l = System.nanoTime();
|
||||
@@ -121,6 +122,9 @@ public class ConfigPack implements LoaderRegistrar {
|
||||
|
||||
try {
|
||||
selfLoader.load(template, new FileInputStream(pack));
|
||||
|
||||
main.getLogger().info("Loading config pack \"" + template.getID() + "\"");
|
||||
|
||||
load(l, main);
|
||||
ConfigPackPostTemplate packPostTemplate = new ConfigPackPostTemplate();
|
||||
selfLoader.load(packPostTemplate, new FileInputStream(pack));
|
||||
@@ -129,9 +133,14 @@ public class ConfigPack implements LoaderRegistrar {
|
||||
} catch(FileNotFoundException e) {
|
||||
throw new FileMissingException("No pack.yml file found in " + folder.getAbsolutePath(), e);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
main.getLogger().severe("Failed to load config pack from folder \"" + folder.getAbsolutePath() + "\"");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigPack(ZipFile file, TerraPlugin main) throws ConfigException {
|
||||
try {
|
||||
this.loader = new ZIPLoader(file);
|
||||
this.main = main;
|
||||
long l = System.nanoTime();
|
||||
@@ -145,7 +154,6 @@ public class ConfigPack implements LoaderRegistrar {
|
||||
main.register(selfLoader);
|
||||
main.register(abstractConfigLoader);
|
||||
|
||||
|
||||
try {
|
||||
ZipEntry pack = null;
|
||||
Enumeration<? extends ZipEntry> entries = file.entries();
|
||||
@@ -157,6 +165,7 @@ public class ConfigPack implements LoaderRegistrar {
|
||||
if(pack == null) throw new FileMissingException("No pack.yml file found in " + file.getName());
|
||||
|
||||
selfLoader.load(template, file.getInputStream(pack));
|
||||
main.getLogger().info("Loading config pack \"" + template.getID() + "\"");
|
||||
|
||||
load(l, main);
|
||||
|
||||
@@ -168,6 +177,10 @@ public class ConfigPack implements LoaderRegistrar {
|
||||
} catch(IOException e) {
|
||||
throw new LoadException("Unable to load pack.yml from ZIP file", e);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
main.getLogger().severe("Failed to load config pack from ZIP archive \"" + file.getName() + "\"");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static <C extends AbstractableTemplate, O> void buildAll(TerraFactory<C, O> factory, TerraRegistry<O> registry, List<C> configTemplates, TerraPlugin main) throws LoadException {
|
||||
|
||||
Reference in New Issue
Block a user