chore: clean up logging
This commit is contained in:
parent
0dc1187d3a
commit
5969d786e4
@ -30,7 +30,7 @@ jfMod {
|
|||||||
minecraftVersion = "1.20.6"
|
minecraftVersion = "1.20.6"
|
||||||
yarn("build.1")
|
yarn("build.1")
|
||||||
loaderVersion = "0.15.10"
|
loaderVersion = "0.15.10"
|
||||||
libJfVersion = "3.15.2"
|
libJfVersion = "3.15.8"
|
||||||
fabricApiVersion = "0.97.8+1.20.6"
|
fabricApiVersion = "0.97.8+1.20.6"
|
||||||
|
|
||||||
modrinth {
|
modrinth {
|
||||||
|
@ -64,7 +64,7 @@ public enum DirFilterEvents implements IEvents {
|
|||||||
// New search for fallback path
|
// New search for fallback path
|
||||||
String newPath = replacement.toFallback(path);
|
String newPath = replacement.toFallback(path);
|
||||||
if (newPath.split("/", 3).length != 3) {
|
if (newPath.split("/", 3).length != 3) {
|
||||||
Respackopts.LOGGER.error("Directory fallback path MUST be long enough to support representation as identifier (3 segments), but is too short: " + newPath);
|
Respackopts.LOGGER.error("Directory fallback path MUST be long enough to support representation as identifier (3 segments), but is too short: {0}", newPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!dirFilterAdditive) {
|
if (!dirFilterAdditive) {
|
||||||
@ -79,16 +79,16 @@ public enum DirFilterEvents implements IEvents {
|
|||||||
int prefixSize = replacement.original.prefix().length();
|
int prefixSize = replacement.original.prefix().length();
|
||||||
if (prefixSize < searchPrefix.length()) {
|
if (prefixSize < searchPrefix.length()) {
|
||||||
if (!searchPrefix.startsWith(replacement.original.prefix())) {
|
if (!searchPrefix.startsWith(replacement.original.prefix())) {
|
||||||
Respackopts.LOGGER.error("Unexpected prefix path " + replacement.original.prefix() + " for search prefix " + searchPrefix + ", skipping");
|
Respackopts.LOGGER.error("Unexpected prefix path {0} for search prefix {1}, skipping", replacement.original.prefix(), searchPrefix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fallbackDir += searchPrefix.substring(prefixSize);
|
fallbackDir += searchPrefix.substring(prefixSize);
|
||||||
} else if (!replacement.original.prefix().startsWith(searchPrefix)) {
|
} else if (!replacement.original.prefix().startsWith(searchPrefix)) {
|
||||||
Respackopts.LOGGER.error("Unexpected prefix path " + replacement.original.prefix() + " for search prefix " + searchPrefix + ", skipping");
|
Respackopts.LOGGER.error("Unexpected prefix path {0} for search prefix {1}, skipping", replacement.original.prefix(), searchPrefix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fallbackDir.split("/", 3).length != 3) {
|
if (fallbackDir.split("/", 3).length != 3) {
|
||||||
Respackopts.LOGGER.error("Directory fallback path MUST be long enough to support representation as identifier (3 segments), but is too short: " + fallbackDir);
|
Respackopts.LOGGER.error("Directory fallback path MUST be long enough to support representation as identifier (3 segments), but is too short: {0}", fallbackDir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ResourcePath rp = new ResourcePath(fallbackDir);
|
ResourcePath rp = new ResourcePath(fallbackDir);
|
||||||
@ -142,7 +142,7 @@ public enum DirFilterEvents implements IEvents {
|
|||||||
currentRPOs.add(newRPO);
|
currentRPOs.add(newRPO);
|
||||||
return currentRPOs;
|
return currentRPOs;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Respackopts.LOGGER.error("Couldn't open dir rpo " + rp, e);
|
Respackopts.LOGGER.error("Couldn't open dir rpo {0}", rp, e);
|
||||||
}
|
}
|
||||||
return parentRPOs;
|
return parentRPOs;
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ public sealed interface DirRpoResult {
|
|||||||
return m.replaceAll(this.fallback.quoted);
|
return m.replaceAll(this.fallback.quoted);
|
||||||
}
|
}
|
||||||
if (!m.find()) {
|
if (!m.find()) {
|
||||||
Respackopts.LOGGER.error("Attempted conversion to fallback path, but could not find original prefix for: " + original);
|
Respackopts.LOGGER.error("Attempted conversion to fallback path, but could not find original prefix for: {0}", original);
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
return m.replaceFirst(this.fallback.quoted);
|
return m.replaceFirst(this.fallback.quoted);
|
||||||
@ -85,7 +85,7 @@ public sealed interface DirRpoResult {
|
|||||||
return m.replaceAll(this.original.quoted);
|
return m.replaceAll(this.original.quoted);
|
||||||
}
|
}
|
||||||
if (!m.find()) {
|
if (!m.find()) {
|
||||||
Respackopts.LOGGER.error("Attempted conversion to original path, but could not find fallback prefix for: " + fallback);
|
Respackopts.LOGGER.error("Attempted conversion to original path, but could not find fallback prefix for: {0}", fallback);
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
return m.replaceFirst(this.original.quoted);
|
return m.replaceFirst(this.original.quoted);
|
||||||
|
@ -16,7 +16,7 @@ public class FileDependencyTracker {
|
|||||||
|
|
||||||
public void addDependency(String to, String on) {
|
public void addDependency(String to, String on) {
|
||||||
if (to.equals(on)) {
|
if (to.equals(on)) {
|
||||||
if (reportedRecursions.add(to)) Respackopts.LOGGER.warn("Discovered recursive dependency in " + pack + "! If you get a StackOverflowException, please validate your fallbacks for " + to);
|
if (reportedRecursions.add(to)) Respackopts.LOGGER.warn("Discovered recursive dependency in {0}! If you get a StackOverflowException, please validate your fallbacks for {1}", pack, to);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gs(dependencies, to).add(on);
|
gs(dependencies, to).add(on);
|
||||||
|
@ -33,7 +33,7 @@ public class FileFallbackProvider {
|
|||||||
if (is != null) return is;
|
if (is != null) return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Respackopts.LOGGER.error("Could not determine replacement for " + file);
|
Respackopts.LOGGER.error("Could not determine replacement for {0}", file);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Respackopts.LOGGER.error("Could not determine replacement for " + file, e);
|
Respackopts.LOGGER.error("Could not determine replacement for " + file, e);
|
||||||
|
@ -54,12 +54,12 @@ public class ResourcePackManagerMixin {
|
|||||||
Path pack = ((DirectoryResourcePackAccessor) drp).getRoot();
|
Path pack = ((DirectoryResourcePackAccessor) drp).getRoot();
|
||||||
Path parent = pack == null ? null : pack.getParent();
|
Path parent = pack == null ? null : pack.getParent();
|
||||||
if (parent != null) dataLocation = parent.resolve(pack.getFileName() + Respackopts.FILE_EXTENSION);
|
if (parent != null) dataLocation = parent.resolve(pack.getFileName() + Respackopts.FILE_EXTENSION);
|
||||||
else Respackopts.LOGGER.warn("Base path of directory resource pack " + rpi.getId() + " is null. This shouldn't happen!");
|
else Respackopts.LOGGER.warn("Base path of directory resource pack {0} is null. This shouldn't happen!", rpi.getId());
|
||||||
} else if (rpi instanceof ZipResourcePack zrp) {
|
} else if (rpi instanceof ZipResourcePack zrp) {
|
||||||
File pack = ((ZipFileWrapperAccessor) ((ZipResourcePackAccessor) zrp).getZipFile()).getFile();
|
File pack = ((ZipFileWrapperAccessor) ((ZipResourcePackAccessor) zrp).getZipFile()).getFile();
|
||||||
Path parent = pack == null ? null : pack.toPath().getParent();
|
Path parent = pack == null ? null : pack.toPath().getParent();
|
||||||
if (parent != null) dataLocation = parent.resolve(pack.getName() + Respackopts.FILE_EXTENSION);
|
if (parent != null) dataLocation = parent.resolve(pack.getName() + Respackopts.FILE_EXTENSION);
|
||||||
else Respackopts.LOGGER.warn("Base path of zip resource pack " + rpi.getId() + " is null. This shouldn't happen!");
|
else Respackopts.LOGGER.warn("Base path of zip resource pack {0} is null. This shouldn't happen!", rpi.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
var conf = rpi.openRoot(Respackopts.ID + ".json5");
|
var conf = rpi.openRoot(Respackopts.ID + ".json5");
|
||||||
@ -94,13 +94,13 @@ public class ResourcePackManagerMixin {
|
|||||||
PackMeta conf = GC_PackMeta.deserialize(isr, LibJf.LENIENT_TRANSPORT);
|
PackMeta conf = GC_PackMeta.deserialize(isr, LibJf.LENIENT_TRANSPORT);
|
||||||
if (!Respackopts.isLegal(conf.id)) {
|
if (!Respackopts.isLegal(conf.id)) {
|
||||||
if (conf.version >= 10) {
|
if (conf.version >= 10) {
|
||||||
Respackopts.LOGGER.error(displayName + " was not loaded as it uses an unsupported pack id: " + conf.id);
|
Respackopts.LOGGER.error("{0} was not loaded as it uses an unsupported pack id: {1}", displayName, conf.id);
|
||||||
return null;
|
return null;
|
||||||
} else conf.id = Respackopts.sanitizeString(conf.id);
|
} else conf.id = Respackopts.sanitizeString(conf.id);
|
||||||
}
|
}
|
||||||
if (RespackoptsConfig.debugLogs) Respackopts.LOGGER.info("Discovered pack: " + conf.id);
|
if (RespackoptsConfig.debugLogs) Respackopts.LOGGER.info("Discovered pack: {0}", conf.id);
|
||||||
if (Respackopts.META_VERSION < conf.version) {
|
if (Respackopts.META_VERSION < conf.version) {
|
||||||
Respackopts.LOGGER.error(displayName + " was not loaded as it specifies a newer respackopts version than is installed");
|
Respackopts.LOGGER.error("{0} was not loaded as it specifies a newer respackopts version than is installed", displayName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (dataLocation == null) dataLocation = Respackopts.FALLBACK_CONF_DIR.resolve(conf.id + ".json");
|
if (dataLocation == null) dataLocation = Respackopts.FALLBACK_CONF_DIR.resolve(conf.id + ".json");
|
||||||
|
@ -33,7 +33,7 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> imple
|
|||||||
for (Iterator<String> iterator = getValue().keySet().iterator(); iterator.hasNext(); ) {
|
for (Iterator<String> iterator = getValue().keySet().iterator(); iterator.hasNext(); ) {
|
||||||
String s = iterator.next();
|
String s = iterator.next();
|
||||||
if (!Respackopts.isLegal(s)) {
|
if (!Respackopts.isLegal(s)) {
|
||||||
Respackopts.LOGGER.error("Illegal entry for " + getName() + ", skipping: " + s);
|
Respackopts.LOGGER.error("Illegal entry for {0}, skipping: {1}", getName(), s);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,10 +60,10 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> imple
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (mode == ConfigSyncMode.RESPACK_LOAD) {
|
if (mode == ConfigSyncMode.RESPACK_LOAD) {
|
||||||
Respackopts.LOGGER.warn("Type mismatch in config (" + getName() + "), overwriting");
|
Respackopts.LOGGER.warn("Type mismatch in config ({0}), overwriting", getName());
|
||||||
add(e.getKey(), e.getValue().clone());
|
add(e.getKey(), e.getValue().clone());
|
||||||
} else
|
} else
|
||||||
Respackopts.LOGGER.warn("Type mismatch in config (" + getName() + "), ignoring");
|
Respackopts.LOGGER.warn("Type mismatch in config ({0}}), ignoring", getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> imple
|
|||||||
|
|
||||||
public <T> void add(String name, ConfigEntry<T> val) {
|
public <T> void add(String name, ConfigEntry<T> val) {
|
||||||
if (version >= 10 && !Respackopts.isLegal(name)) {
|
if (version >= 10 && !Respackopts.isLegal(name)) {
|
||||||
Respackopts.LOGGER.error("Illegal entry for " + getName() + ", skipping: " + name);
|
Respackopts.LOGGER.error("Illegal entry for {0}, skipping: {1}", getName(), name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
val.setVersion(version);
|
val.setVersion(version);
|
||||||
@ -125,7 +125,7 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> imple
|
|||||||
super.getValue().forEach((key, value) -> {
|
super.getValue().forEach((key, value) -> {
|
||||||
if (Respackopts.isLegal(key)) map.put(key, value);
|
if (Respackopts.isLegal(key)) map.put(key, value);
|
||||||
else if (version >= 10) {
|
else if (version >= 10) {
|
||||||
Respackopts.LOGGER.error("Illegal key in " + getName() + ", skipping: " + key);
|
Respackopts.LOGGER.error("Illegal key in {0}, skipping: {1}", getName(), key);
|
||||||
} else map.put(Respackopts.sanitizeString(key), value);
|
} else map.put(Respackopts.sanitizeString(key), value);
|
||||||
});
|
});
|
||||||
return DFinal.of(map);
|
return DFinal.of(map);
|
||||||
@ -161,7 +161,7 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> imple
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
builder.executeAfterWrite(cfg -> {
|
builder.executeAfterWrite(cfg -> {
|
||||||
if (RespackoptsConfig.debugLogs) Respackopts.LOGGER.info("GuiFactory SavingRunnable " + agg.get());
|
if (RespackoptsConfig.debugLogs) Respackopts.LOGGER.info("GuiFactory SavingRunnable {0}", agg.get());
|
||||||
MetaCache.save(new SaveHook.Arguments(agg.get() == PackReloadType.Resource, false, true));
|
MetaCache.save(new SaveHook.Arguments(agg.get() == PackReloadType.Resource, false, true));
|
||||||
});
|
});
|
||||||
builder.setPath(dataLocation);
|
builder.setPath(dataLocation);
|
||||||
|
@ -43,7 +43,7 @@ public abstract class ConfigEntry<T> implements DynamicBase {
|
|||||||
public T getValue() {
|
public T getValue() {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (defaultValue == null) {
|
if (defaultValue == null) {
|
||||||
Respackopts.LOGGER.warn("No default value or current value set for entry, returning null in " + getName());
|
Respackopts.LOGGER.warn("No default value or current value set for entry, returning null in {0}", getName());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
value = getDefault();
|
value = getDefault();
|
||||||
@ -60,7 +60,7 @@ public abstract class ConfigEntry<T> implements DynamicBase {
|
|||||||
public T getDefault() {
|
public T getDefault() {
|
||||||
if (defaultValue == null) {
|
if (defaultValue == null) {
|
||||||
defaultValue = getValue();
|
defaultValue = getValue();
|
||||||
Respackopts.LOGGER.warn("No default value set for entry, using current in " + getName());
|
Respackopts.LOGGER.warn("No default value set for entry, using current in {0}", getName());
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class ConfigEnumEntry extends ConfigEntry<String> implements DelegateDyna
|
|||||||
for (Iterator<String> iterator = values.iterator(); iterator.hasNext();) {
|
for (Iterator<String> iterator = values.iterator(); iterator.hasNext();) {
|
||||||
String value = iterator.next();
|
String value = iterator.next();
|
||||||
if (!Respackopts.isLegal(value)) {
|
if (!Respackopts.isLegal(value)) {
|
||||||
Respackopts.LOGGER.error("Illegal enum entry for " + getName() + ", skipping: " + value);
|
Respackopts.LOGGER.error("Illegal enum entry for {0}, skipping: {1}", getName(), value);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ public class ConfigEnumEntry extends ConfigEntry<String> implements DelegateDyna
|
|||||||
setValue(values.get(n.nextValue));
|
setValue(values.get(n.nextValue));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Respackopts.LOGGER.error("Could not load default value for enum in " + getName());
|
Respackopts.LOGGER.error("Could not load default value for enum in {0}", getName());
|
||||||
}
|
}
|
||||||
} else nextValue = null;
|
} else nextValue = null;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class MetaCache {
|
|||||||
|
|
||||||
public static void addFromScan(String displayName, String packName, PackMeta meta, Path dataLocation) {
|
public static void addFromScan(String displayName, String packName, PackMeta meta, Path dataLocation) {
|
||||||
if (Respackopts.META_VERSION > meta.version) {
|
if (Respackopts.META_VERSION > meta.version) {
|
||||||
Respackopts.LOGGER.warn(displayName + " uses an outdated RPO format (" + meta.version + "). Although this is supported, using the latest version (" + Respackopts.META_VERSION + ") is recommended");
|
Respackopts.LOGGER.warn("{0} uses an outdated RPO format ({1}). Although this is supported, using the latest version ({2}) is recommended", displayName, meta.version, Respackopts.META_VERSION);
|
||||||
}
|
}
|
||||||
meta.conf.setVersion(meta.version);
|
meta.conf.setVersion(meta.version);
|
||||||
if (meta.version < 5) meta.capabilities.add(PackCapability.DirFilter);
|
if (meta.version < 5) meta.capabilities.add(PackCapability.DirFilter);
|
||||||
@ -124,7 +124,7 @@ public class MetaCache {
|
|||||||
public static void load(CacheKey key) {
|
public static void load(CacheKey key) {
|
||||||
if (Files.exists(key.dataLocation())) {
|
if (Files.exists(key.dataLocation())) {
|
||||||
if (RespackoptsConfig.debugLogs)
|
if (RespackoptsConfig.debugLogs)
|
||||||
Respackopts.LOGGER.info("Loading configs for: " + key.displayName());
|
Respackopts.LOGGER.info("Loading configs for: {0}", key.displayName());
|
||||||
try (Reader reader = Files.newBufferedReader(key.dataLocation())) {
|
try (Reader reader = Files.newBufferedReader(key.dataLocation())) {
|
||||||
ConfigBranch b = GC_ConfigBranch.deserialize(reader, LibJf.LENIENT_TRANSPORT);
|
ConfigBranch b = GC_ConfigBranch.deserialize(reader, LibJf.LENIENT_TRANSPORT);
|
||||||
if (PACK_STATES.containsKey(key))
|
if (PACK_STATES.containsKey(key))
|
||||||
|
Loading…
Reference in New Issue
Block a user