summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/DeprecationManager.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-02-08 18:20:03 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-02-08 18:20:03 -0500
commit84b9f4336d5b0c7f269a7bfbb94042360574bbaa (patch)
tree0a4d138f88522ca101bff739c8ade1f62c74fbfe /src/SMAPI/Framework/DeprecationManager.cs
parent79c616600576acf16f70daad68cc60a22cbbbf74 (diff)
parent41f77f51c0203fa36c1e47cf67409244ed3c2ff2 (diff)
downloadSMAPI-84b9f4336d5b0c7f269a7bfbb94042360574bbaa.tar.gz
SMAPI-84b9f4336d5b0c7f269a7bfbb94042360574bbaa.tar.bz2
SMAPI-84b9f4336d5b0c7f269a7bfbb94042360574bbaa.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/DeprecationManager.cs')
-rw-r--r--src/SMAPI/Framework/DeprecationManager.cs27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs
index 76c2f616..fcdf722e 100644
--- a/src/SMAPI/Framework/DeprecationManager.cs
+++ b/src/SMAPI/Framework/DeprecationManager.cs
@@ -62,7 +62,7 @@ namespace StardewModdingAPI.Framework
return;
// queue warning
- this.QueuedWarnings.Add(new DeprecationWarning(source, nounPhrase, version, severity));
+ this.QueuedWarnings.Add(new DeprecationWarning(source, nounPhrase, version, severity, Environment.StackTrace));
}
/// <summary>Print any queued messages.</summary>
@@ -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}{Environment.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();
}