Skip to content

Commit 7c0859f

Browse files
committed
PersistentIConfigNode : Moved some logging from errors to warnings as users keep pestering me about those instead of pestering the authors of the problematic config files, and attempted to make the logged messages a bit clearer.
1 parent fc19e3b commit 7c0859f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

KSPCommunityFixes/Modding/PersistentIConfigNode.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ public bool Read(Value value, object host, int attribIndex)
182182
{
183183
if (attribIndex >= attribs.Length)
184184
{
185-
Debug.LogError($"[KSPCommunityFixes] Tried to read value `{value.name} = {value.value}` for field {fieldInfo.Name}, index was {attribIndex} but only {attribs.Length} [Persistent] attributes on that field on host object of type {host.AssemblyQualifiedName()}."
186-
+ "\nThis is probably because the value was specified twice in the config. Making that assumption and clamping.");
185+
Debug.LogWarning($"[KSPCF] Value `{value.name} = {value.value}` on object `{host.AssemblyQualifiedName()}` is the {attribIndex + 1}nth value read, but only {attribs.Length} [Persistent] attributes are defined. "
186+
+ "The value will be applied, but it was likely incorrectly specified twice in the config");
187187
attribIndex = 0;
188188
}
189189
if (attribs[attribIndex].link)
@@ -213,8 +213,8 @@ public bool Read(ConfigNode node, object host, int attribIndex)
213213
{
214214
if (attribIndex >= attribs.Length)
215215
{
216-
Debug.LogError($"[KSPCommunityFixes] Tried to read node `{node.name}` for field {fieldInfo.Name}, index was {attribIndex} but only {attribs.Length} [Persistent] attributes on that field on host object of type {host.AssemblyQualifiedName()}."
217-
+ "\nThis is probably because the node was specified twice in the config. Making that assumption and clamping.");
216+
Debug.LogWarning($"[KSPCF] Node `{node.name}` on object `{host.AssemblyQualifiedName()}` is the {attribIndex + 1}nth node read, but only {attribs.Length} [Persistent] attributes are defined. "
217+
+ "The node will be applied, but it was likely incorrectly specified twice in the config");
218218
attribIndex = 0;
219219
}
220220
int vCount = node._values.values.Count;
@@ -580,7 +580,7 @@ public static object ReadValue(string value, DataType dataType, Type fieldType)
580580
{
581581
string[] enumNames = fieldType.GetEnumNames();
582582
string defaultName = enumNames.Length > 0 ? enumNames[0] : string.Empty;
583-
Debug.LogWarning($"[KSPCF] Couldn't parse value '{value}' for enum '{fieldType.Name}', default value '{defaultName}' will be used.\nValid values are {string.Join(", ", enumNames)}");
583+
Debug.LogWarning($"[KSPCF] Couldn't parse value '{value}' for enum '{fieldType.Name}', default value '{defaultName}' will be used. Valid values are {string.Join(", ", enumNames)}");
584584
return null;
585585
}
586586
case DataType.ValueVector2:
@@ -956,7 +956,7 @@ public static TypeCache CreateAndAdd(Type t)
956956
var tc = new TypeCache(t);
957957
if (tc._fields.Count == 0)
958958
{
959-
Debug.LogWarning($"[KSPCommunityFixes]: No Persistent fields on object of type {t.AssemblyQualifiedName()}, adding as null to TypeCache. That object likely shouldn't implement the IConfigNode interface.");
959+
Debug.LogWarning($"[KSPCF] No Persistent fields on object of type {t.AssemblyQualifiedName()}, adding as null to TypeCache. That object likely shouldn't implement the IConfigNode interface.");
960960
tc = null;
961961
}
962962

0 commit comments

Comments
 (0)