increase all notice deprecations to info, tweak deprecation message format

This commit is contained in:
Jesse Plamondon-Willard 2017-02-16 13:59:13 -05:00
parent f8866ac4a8
commit 16c362f4c5
9 changed files with 15 additions and 15 deletions

View File

@ -14,9 +14,9 @@ For mod developers:
* Added `SaveEvents.AfterReturnToTitle` and `TimeEvents.AfterDayStarted` events.
* Added a simpler API for console commands (see `helper.ConsoleCommands`).
* Added `GetPrivateProperty` reflection helper.
* Many deprecated APIs have been removed; see the
[deprecation guide](http://canimod.com/guides/updating-a-smapi-mod) for more information.
* Log files now always use `\r\n` to simplify crossplatform viewing.
* Several obsolete APIs have been removed (see [deprecation guide](http://canimod.com/guides/updating-a-smapi-mod)),
and all _notice_-level deprecations have been increased to _info_.
For SMAPI developers:
* Added support for debugging with Visual Studio for Mac.

View File

@ -94,7 +94,7 @@ namespace StardewModdingAPI
/// <param name="monitor">Encapsulates monitoring and logging.</param>
public static void CallCommand(string input, IMonitor monitor)
{
Command.DeprecationManager.Warn("Command.CallCommand", "1.9", DeprecationLevel.Notice);
Command.DeprecationManager.Warn("Command.CallCommand", "1.9", DeprecationLevel.Info);
Command.CommandManager.Trigger(input);
}
@ -107,7 +107,7 @@ namespace StardewModdingAPI
name = name?.Trim().ToLower();
// raise deprecation warning
Command.DeprecationManager.Warn("Command.RegisterCommand", "1.9", DeprecationLevel.Notice);
Command.DeprecationManager.Warn("Command.RegisterCommand", "1.9", DeprecationLevel.Info);
// validate
if (Command.LegacyCommands.ContainsKey(name))
@ -130,7 +130,7 @@ namespace StardewModdingAPI
/// <param name="name">The command name to find.</param>
public static Command FindCommand(string name)
{
Command.DeprecationManager.Warn("Command.FindCommand", "1.9", DeprecationLevel.Notice);
Command.DeprecationManager.Warn("Command.FindCommand", "1.9", DeprecationLevel.Info);
if (name == null)
return null;

View File

@ -125,7 +125,7 @@ namespace StardewModdingAPI
/// <summary>Construct an instance.</summary>
protected Config()
{
Config.DeprecationManager.Warn("the Config class", "1.0", DeprecationLevel.Notice);
Config.DeprecationManager.Warn("the Config class", "1.0", DeprecationLevel.Info);
Config.DeprecationManager.MarkWarned($"{nameof(Mod)}.{nameof(Mod.BaseConfigPath)}", "1.0"); // typically used to construct config, avoid redundant warnings
}
}

View File

@ -56,7 +56,7 @@ namespace StardewModdingAPI.Events
string name = $"{nameof(PlayerEvents)}.{nameof(PlayerEvents.LoadedGame)}";
Delegate[] handlers = PlayerEvents.LoadedGame.GetInvocationList();
PlayerEvents.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Notice);
PlayerEvents.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Info);
monitor.SafelyRaiseGenericEvent(name, handlers, null, loaded);
}
@ -72,7 +72,7 @@ namespace StardewModdingAPI.Events
string name = $"{nameof(PlayerEvents)}.{nameof(PlayerEvents.FarmerChanged)}";
Delegate[] handlers = PlayerEvents.FarmerChanged.GetInvocationList();
PlayerEvents.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Notice);
PlayerEvents.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Info);
monitor.SafelyRaiseGenericEvent(name, handlers, null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
}

View File

@ -102,7 +102,7 @@ namespace StardewModdingAPI.Events
string name = $"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}";
Delegate[] handlers = TimeEvents.OnNewDay.GetInvocationList();
TimeEvents.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Notice);
TimeEvents.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Info);
monitor.SafelyRaiseGenericEvent(name, handlers, null, new EventArgsNewDay(priorDay, newDay, isTransitioning));
}
}

View File

@ -70,7 +70,7 @@ namespace StardewModdingAPI.Framework
break;
case DeprecationLevel.Info:
this.Monitor.Log(message, LogLevel.Info);
this.Monitor.Log(message, LogLevel.Warn);
break;
case DeprecationLevel.PendingRemoval:

View File

@ -306,7 +306,7 @@ namespace StardewModdingAPI
/// <summary>Raise a deprecation warning.</summary>
private static void WarnDeprecated()
{
Log.DeprecationManager.Warn($"the {nameof(Log)} class", "1.1", DeprecationLevel.Notice);
Log.DeprecationManager.Warn($"the {nameof(Log)} class", "1.1", DeprecationLevel.Info);
}
/// <summary>Get the name of the mod logging a message from the stack.</summary>

View File

@ -35,7 +35,7 @@ namespace StardewModdingAPI
{
get
{
Mod.DeprecationManager.Warn($"{nameof(Mod)}.{nameof(Mod.PathOnDisk)}", "1.0", DeprecationLevel.Notice);
Mod.DeprecationManager.Warn($"{nameof(Mod)}.{nameof(Mod.PathOnDisk)}", "1.0", DeprecationLevel.Info);
return this._pathOnDisk;
}
internal set { this._pathOnDisk = value; }
@ -47,7 +47,7 @@ namespace StardewModdingAPI
{
get
{
Mod.DeprecationManager.Warn($"{nameof(Mod)}.{nameof(Mod.BaseConfigPath)}", "1.0", DeprecationLevel.Notice);
Mod.DeprecationManager.Warn($"{nameof(Mod)}.{nameof(Mod.BaseConfigPath)}", "1.0", DeprecationLevel.Info);
Mod.DeprecationManager.MarkWarned($"{nameof(Mod)}.{nameof(Mod.PathOnDisk)}", "1.0"); // avoid redundant warnings
return Path.Combine(this.PathOnDisk, "config.json");
}
@ -96,7 +96,7 @@ namespace StardewModdingAPI
[Obsolete]
private string GetPerSaveConfigFolder()
{
Mod.DeprecationManager.Warn($"{nameof(Mod)}.{nameof(Mod.PerSaveConfigFolder)}", "1.0", DeprecationLevel.Notice);
Mod.DeprecationManager.Warn($"{nameof(Mod)}.{nameof(Mod.PerSaveConfigFolder)}", "1.0", DeprecationLevel.Info);
Mod.DeprecationManager.MarkWarned($"{nameof(Mod)}.{nameof(Mod.PathOnDisk)}", "1.0"); // avoid redundant warnings
if (!((Manifest)this.ModManifest).PerSaveConfigs)

View File

@ -552,7 +552,7 @@ namespace StardewModdingAPI
// raise deprecation warning for old Entry() methods
if (this.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(object[]) }))
this.DeprecationManager.Warn(mod.ModManifest.Name, $"{nameof(Mod)}.{nameof(Mod.Entry)}(object[]) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.0", DeprecationLevel.Notice);
this.DeprecationManager.Warn(mod.ModManifest.Name, $"{nameof(Mod)}.{nameof(Mod.Entry)}(object[]) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.0", DeprecationLevel.Info);
}
catch (Exception ex)
{