From 929dccb75a1405737975d76648e015a3e7c00177 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 7 Oct 2017 23:07:10 -0400 Subject: reorganise repo structure --- .../Framework/Logging/LogFileManager.cs | 57 ---------------------- 1 file changed, 57 deletions(-) delete mode 100644 src/StardewModdingAPI/Framework/Logging/LogFileManager.cs (limited to 'src/StardewModdingAPI/Framework/Logging/LogFileManager.cs') diff --git a/src/StardewModdingAPI/Framework/Logging/LogFileManager.cs b/src/StardewModdingAPI/Framework/Logging/LogFileManager.cs deleted file mode 100644 index 8cfe0527..00000000 --- a/src/StardewModdingAPI/Framework/Logging/LogFileManager.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.IO; - -namespace StardewModdingAPI.Framework.Logging -{ - /// Manages reading and writing to log file. - internal class LogFileManager : IDisposable - { - /********* - ** Properties - *********/ - /// The underlying stream writer. - private readonly StreamWriter Stream; - - - /********* - ** Accessors - *********/ - /// The full path to the log file being written. - public string Path { get; } - - - /********* - ** Public methods - *********/ - /// Construct an instance. - /// The log file to write. - public LogFileManager(string path) - { - this.Path = path; - - // create log directory if needed - string logDir = System.IO.Path.GetDirectoryName(path); - if (logDir == null) - throw new ArgumentException($"The log path '{path}' is not valid."); - Directory.CreateDirectory(logDir); - - // open log file stream - this.Stream = new StreamWriter(path, append: false) { AutoFlush = true }; - } - - /// Write a message to the log. - /// The message to log. - public void WriteLine(string message) - { - // always use Windows-style line endings for convenience - // (Linux/Mac editors are fine with them, Windows editors often require them) - this.Stream.Write(message + "\r\n"); - } - - /// Release all resources. - public void Dispose() - { - this.Stream.Dispose(); - } - } -} -- cgit