Skip to content

Commit 908cca3

Browse files
committed
Conditional dumping of the Patch Log into the KSP.log
1 parent 102cff3 commit 908cca3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Source/ModuleManager/MMPatchLoader.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,27 @@ public IEnumerable<IProtoUrlConfig> Run()
196196
databaseConfigs = LoadCache();
197197
}
198198

199-
#if false
200199
// Using an dedicated external log is nice. Dumping it into KSP.log breaking the known formats is not.
200+
// But...
201+
// Now I see the reason this was done this way. Asking the user to send KSP.log is tricky by itself, and
202+
// sending more than one log is yet more troublesome.
203+
// What I can do is to only dump this on KSP.log when the KSPe.Util.Log.Level is bigger than Info.
204+
// (the default KSPe's Global for Module Manager as from KSPe 2.2.3)
205+
string patchLogPath = KSPe.IO.File<Startup>.Data.Solve(FilePathRepository.PATCH_LOG_FILENAME + ".log");
201206
if (File.Exists(patchLogPath))
202207
{
203-
logger.Info("Dumping patch log");
204-
logger.Info("\n#### BEGIN PATCH LOG ####\n\n\n" + File.ReadAllText(patchLogPath) + "\n\n\n#### END PATCH LOG ####");
208+
if (ModLogger.LOG.level > KSPe.Util.Log.Level.INFO)
209+
{
210+
logger.Info("Dumping patch log");
211+
logger.Info("\n#### BEGIN PATCH LOG ####\n\n\n" + File.ReadAllText(patchLogPath) + "\n\n\n#### END PATCH LOG ####");
212+
}
213+
else
214+
logger.Info("The Patch log can be found on " + patchLogPath);
205215
}
206216
else
207217
{
208218
logger.Error("Patch log does not exist: " + patchLogPath);
209219
}
210-
#endif
211220

212221
logger.Info(status);
213222

0 commit comments

Comments
 (0)