summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StardewModdingAPI/Program.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 090098ca..9cb84cf5 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -125,7 +125,7 @@ namespace StardewModdingAPI
Program.Monitor.Log($"You configured SMAPI to not check for updates. Running an old version of SMAPI is not recommended. You can enable update checks by editing or deleting {Constants.ApiConfigPath}.", LogLevel.Warn);
// initialise legacy log
- Log.Monitor = new Monitor("legacy mod", Program.LogFile) { ShowTraceInConsole = Program.Settings.DeveloperMode };
+ Log.Monitor = Program.GetSecondaryMonitor("legacy mod");
Log.ModRegistry = Program.ModRegistry;
// hook into & launch the game
@@ -183,7 +183,7 @@ namespace StardewModdingAPI
internal static IMonitor GetLegacyMonitorForMod()
{
string modName = Program.ModRegistry.GetModFromStack() ?? "unknown";
- return new Monitor(modName, Program.LogFile);
+ return Program.GetSecondaryMonitor(modName);
}
@@ -518,7 +518,7 @@ namespace StardewModdingAPI
// inject data
mod.ModManifest = manifest;
mod.Helper = helper;
- mod.Monitor = new Monitor(manifest.Name, Program.LogFile) { ShowTraceInConsole = Program.Settings.DeveloperMode };
+ mod.Monitor = Program.GetSecondaryMonitor(manifest.Name);
mod.PathOnDisk = directory;
// track mod
@@ -590,5 +590,12 @@ namespace StardewModdingAPI
Console.ReadKey();
Environment.Exit(0);
}
+
+ /// <summary>Get a monitor instance derived from SMAPI's current settings.</summary>
+ /// <param name="name">The name of the module which will log messages with this instance.</param>
+ private static Monitor GetSecondaryMonitor(string name)
+ {
+ return new Monitor(name, Program.LogFile) { ShowTraceInConsole = Program.Settings.DeveloperMode };
+ }
}
}