diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-04 22:02:59 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-04 22:02:59 -0400 |
commit | 4088f4cb2bfe777cf6f86ac5fbf64f7d67565057 (patch) | |
tree | 859199135d654f7bf6b356a8b20ff5259bf51025 /src/SMAPI/Framework/Logging/LogManager.cs | |
parent | f57feb7319725513fadde8b14d55f4e8e4b82c24 (diff) | |
download | SMAPI-4088f4cb2bfe777cf6f86ac5fbf64f7d67565057.tar.gz SMAPI-4088f4cb2bfe777cf6f86ac5fbf64f7d67565057.tar.bz2 SMAPI-4088f4cb2bfe777cf6f86ac5fbf64f7d67565057.zip |
simplify error shown for duplicate mods
Diffstat (limited to 'src/SMAPI/Framework/Logging/LogManager.cs')
-rw-r--r-- | src/SMAPI/Framework/Logging/LogManager.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs index d0936f3f..094dd749 100644 --- a/src/SMAPI/Framework/Logging/LogManager.cs +++ b/src/SMAPI/Framework/Logging/LogManager.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading; using StardewModdingAPI.Framework.Commands; +using StardewModdingAPI.Framework.ModLoading; using StardewModdingAPI.Internal.ConsoleWriting; using StardewModdingAPI.Toolkit.Framework.ModData; using StardewModdingAPI.Toolkit.Utilities; @@ -397,10 +398,22 @@ namespace StardewModdingAPI.Framework.Logging if (skippedMods.Any()) { // get logging logic + HashSet<string> loggedDuplicateIds = new HashSet<string>(); void LogSkippedMod(IModMetadata mod) { string message = $" - {mod.DisplayName}{(mod.Manifest?.Version != null ? " " + mod.Manifest.Version.ToString() : "")} because {mod.Error}"; + // handle duplicate mods + // (log first duplicate only, don't show redundant version) + if (mod.FailReason == ModFailReason.Duplicate && mod.HasManifest()) + { + if (!loggedDuplicateIds.Add(mod.Manifest.UniqueID)) + return; // already logged + + message = $" - {mod.DisplayName} because {mod.Error}"; + } + + // log message this.Monitor.Log(message, LogLevel.Error); if (mod.ErrorDetails != null) this.Monitor.Log($" ({mod.ErrorDetails})"); |