diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-14 19:31:22 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-14 19:31:22 -0500 |
commit | f9823c2ed091df8c31c6d7338acd69e63f598537 (patch) | |
tree | 6993458a8f7535148ed759db74eb600bd9d662e1 /src/StardewModdingAPI/Framework | |
parent | 06b108d4c4960d8b8bdfc732ba72ac093fc161ba (diff) | |
download | SMAPI-f9823c2ed091df8c31c6d7338acd69e63f598537.tar.gz SMAPI-f9823c2ed091df8c31c6d7338acd69e63f598537.tar.bz2 SMAPI-f9823c2ed091df8c31c6d7338acd69e63f598537.zip |
migrate deprecation manager to new logging (#168)
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r-- | src/StardewModdingAPI/Framework/DeprecationManager.cs | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/StardewModdingAPI/Framework/DeprecationManager.cs b/src/StardewModdingAPI/Framework/DeprecationManager.cs index 2d25db09..20549b3f 100644 --- a/src/StardewModdingAPI/Framework/DeprecationManager.cs +++ b/src/StardewModdingAPI/Framework/DeprecationManager.cs @@ -13,24 +13,22 @@ namespace StardewModdingAPI.Framework /// <summary>The deprecations which have already been logged (as 'mod name::noun phrase::version').</summary> private readonly HashSet<string> LoggedDeprecations = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); + /// <summary>Encapsulates monitoring and logging for a given module.</summary> + private readonly IMonitor Monitor; + /// <summary>Tracks the installed mods.</summary> private readonly ModRegistry ModRegistry; /********* - ** Accessors - *********/ - /// <summary>Whether <see cref="DeprecationLevel.Notice"/>-level deprecation messages should be shown in the console.</summary> - public bool SendNoticesToConsole { get; set; } - - - /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> + /// <param name="monitor">Encapsulates monitoring and logging for a given module.</param> /// <param name="modRegistry">Tracks the installed mods.</param> - public DeprecationManager(ModRegistry modRegistry) + public DeprecationManager(IMonitor monitor, ModRegistry modRegistry) { + this.Monitor = monitor; this.ModRegistry = modRegistry; } @@ -68,18 +66,15 @@ namespace StardewModdingAPI.Framework switch (severity) { case DeprecationLevel.Notice: - if (this.SendNoticesToConsole) - Log.Debug($"[DEV] {message}"); - else - Log.LogToFile(message); + this.Monitor.Log(message, LogLevel.Trace); break; case DeprecationLevel.Info: - Log.Debug(message); + this.Monitor.Log(message, LogLevel.Info); break; case DeprecationLevel.PendingRemoval: - Log.Warning(message); + this.Monitor.Log(message, LogLevel.Warn); break; default: |