Explorar el Código

Improve log/exception messages

Lortseam hace 4 años
padre
commit
beae007fff

+ 2 - 2
lib/src/main/java/me/lortseam/completeconfig/data/BoundedEntry.java

@@ -15,10 +15,10 @@ public class BoundedEntry<T extends Number> extends Entry<T> {
     public BoundedEntry(EntryOrigin origin, T min, T max) {
         super(origin, value -> {
             if (new BigDecimal(value.toString()).compareTo(new BigDecimal(min.toString())) < 0) {
-                logger.warn("[CompleteConfig] Tried to set value of field " + origin.getField() + " to a value less than minimum bound, setting to minimum now!");
+                logger.warn("[CompleteConfig] Tried to set value of field " + origin.getField() + " to a value less than lower bound, setting to minimum now");
                 return min;
             } else if (new BigDecimal(value.toString()).compareTo(new BigDecimal(max.toString())) > 0) {
-                logger.warn("[CompleteConfig] Tried to set value of field " + origin.getField() + " to a value greater than maximum bound, setting to maximum now!");
+                logger.warn("[CompleteConfig] Tried to set value of field " + origin.getField() + " to a value greater than upper bound, setting to maximum now");
                 return max;
             }
             return value;

+ 1 - 1
lib/src/main/java/me/lortseam/completeconfig/data/CollectionSet.java

@@ -16,7 +16,7 @@ public class CollectionSet extends DataSet<Collection> {
         Collection collection = new Collection(groupID, translation.append(groupID), group.getTooltipTranslationKeys(), group.getComment());
         collection.resolve(group);
         if (collection.isEmpty()) {
-            logger.warn("[CompleteConfig] Group " + groupID + " is empty!");
+            logger.warn("[CompleteConfig] Group " + groupID + " is empty");
             return;
         }
         add(collection);

+ 2 - 2
lib/src/main/java/me/lortseam/completeconfig/data/Config.java

@@ -129,12 +129,12 @@ public final class Config extends BaseCollection {
          */
         public Config build() {
             if (children.isEmpty()) {
-                logger.warn("[CompleteConfig] Mod " + modID + " tried to create an empty config!");
+                logger.warn("[CompleteConfig] Mod " + modID + " tried to create an empty config");
                 return null;
             }
             Config config = new Config(new ConfigSource(modID, branch), children);
             if (config.isEmpty()) {
-                logger.warn("[CompleteConfig] Config of " + config.source + " is empty!");
+                logger.warn("[CompleteConfig] Config of " + config.source + " is empty");
                 return null;
             }
             config.load();

+ 2 - 2
lib/src/main/java/me/lortseam/completeconfig/data/Entry.java

@@ -224,7 +224,7 @@ public class Entry<T> implements DataPart, Identifiable {
             if(value == null) return;
             setValue(value);
         } catch (SerializationException e) {
-            logger.error("[CompleteConfig] Failed to apply value to entry!", e);
+            logger.error("[CompleteConfig] Failed to apply value to entry", e);
         }
     }
 
@@ -236,7 +236,7 @@ public class Entry<T> implements DataPart, Identifiable {
                 node.comment(comment);
             }
         } catch (SerializationException e) {
-            logger.error("[CompleteConfig] Failed to fetch value from entry!", e);
+            logger.error("[CompleteConfig] Failed to fetch value from entry", e);
         }
     }
 

+ 3 - 3
lib/src/main/java/me/lortseam/completeconfig/io/ConfigSource.java

@@ -52,7 +52,7 @@ public final class ConfigSource {
         this.modID = modID;
         this.branch = branch;
         if (!sources.add(this)) {
-            throw new IllegalArgumentException("A config of the mod " + modID + " with the specified branch " + Arrays.toString(branch) + " already exists!");
+            throw new IllegalArgumentException("A config of the mod " + modID + " with the specified branch " + Arrays.toString(branch) + " already exists");
         }
         Path path = FabricLoader.getInstance().getConfigDir();
         String[] subPath = ArrayUtils.add(branch, 0, modID);
@@ -80,7 +80,7 @@ public final class ConfigSource {
                 config.apply(root);
             }
         } catch (ConfigurateException e) {
-            logger.error("[CompleteConfig] Failed to load config from file!", e);
+            logger.error("[CompleteConfig] Failed to load config from file", e);
         }
         save(config);
     }
@@ -91,7 +91,7 @@ public final class ConfigSource {
         try {
             loader.save(root);
         } catch (ConfigurateException e) {
-            logger.error("[CompleteConfig] Failed to save config to file!", e);
+            logger.error("[CompleteConfig] Failed to save config to file", e);
         }
     }