summaryrefslogtreecommitdiff
path: root/StardewModdingAPI/Logger.cs
diff options
context:
space:
mode:
Diffstat (limited to 'StardewModdingAPI/Logger.cs')
-rw-r--r--StardewModdingAPI/Logger.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/StardewModdingAPI/Logger.cs b/StardewModdingAPI/Logger.cs
index 8a2241da..0d69b6ec 100644
--- a/StardewModdingAPI/Logger.cs
+++ b/StardewModdingAPI/Logger.cs
@@ -231,6 +231,13 @@ namespace StardewModdingAPI
// ReSharper disable once InconsistentlySynchronizedField
_logQueue = new ConcurrentQueue<LogInfo>();
Console.WriteLine(Constants.LogPath);
+
+ // If the ErrorLogs dir doesn't exist StreamWriter will throw an exception.
+ if (!Directory.Exists(Constants.LogDir))
+ {
+ Directory.CreateDirectory(Constants.LogDir);
+ }
+
_stream = new StreamWriter(Constants.LogPath, false);
Console.WriteLine("Created log instance");
}