summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-31 14:16:43 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-02-07 22:37:42 -0500
commitc4a76df4b07e9b3378f51e00909e09424ba09654 (patch)
tree01d47b953906dcddf51cc46f76a187ab6a2ff12e /src/SMAPI
parente064be0c7b3440b31b616cec8c43946097fdad7d (diff)
downloadSMAPI-c4a76df4b07e9b3378f51e00909e09424ba09654.tar.gz
SMAPI-c4a76df4b07e9b3378f51e00909e09424ba09654.tar.bz2
SMAPI-c4a76df4b07e9b3378f51e00909e09424ba09654.zip
fix 'unknown mod' deprecation warnings showing stack trace in non-developer mode
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Framework/DeprecationManager.cs25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs
index 8d836c8c..fcdf722e 100644
--- a/src/SMAPI/Framework/DeprecationManager.cs
+++ b/src/SMAPI/Framework/DeprecationManager.cs
@@ -78,27 +78,40 @@ namespace StardewModdingAPI.Framework
? $"{warning.ModName ?? "An unknown mod"} uses deprecated code (legacy events are deprecated since SMAPI {warning.Version})."
: $"{warning.ModName ?? "An unknown mod"} uses deprecated code ({warning.NounPhrase} is deprecated since SMAPI {warning.Version}).";
#endif
- if (warning.ModName == null)
- message += $"{Environment.NewLine}{warning.StackTrace}";
- // log message
+ // get log level
+ LogLevel level;
switch (warning.Level)
{
case DeprecationLevel.Notice:
- this.Monitor.Log(message, LogLevel.Trace);
+ level = LogLevel.Trace;
break;
case DeprecationLevel.Info:
- this.Monitor.Log(message, LogLevel.Debug);
+ level = LogLevel.Debug;
break;
case DeprecationLevel.PendingRemoval:
- this.Monitor.Log(message, LogLevel.Warn);
+ level = LogLevel.Warn;
break;
default:
throw new NotSupportedException($"Unknown deprecation level '{warning.Level}'.");
}
+
+ // log message
+ if (warning.ModName != null)
+ this.Monitor.Log(message, level);
+ else
+ {
+ if (level == LogLevel.Trace)
+ this.Monitor.Log($"{message}\n{warning.StackTrace}", level);
+ else
+ {
+ this.Monitor.Log(message, level);
+ this.Monitor.Log(warning.StackTrace);
+ }
+ }
}
this.QueuedWarnings.Clear();
}