diff options
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/DeprecationManager.cs | 25 |
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(); } |