diff options
| author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-07 23:20:36 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-07 23:20:36 -0400 |
| commit | d0dd2f7ba729de6be749d326a2fed78988ba9d7b (patch) | |
| tree | a22127da6a8900e9f29bbb847bfd5d3347f6b952 /src/StardewModdingAPI/Framework/Logging/LogFileManager.cs | |
| parent | 7889676ea24cafc945899bf25608784e3f5bc9e0 (diff) | |
| parent | 5928f5f86c4493ddb6b89bce0b7d0fb73a884c09 (diff) | |
| download | SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.tar.gz SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.tar.bz2 SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.zip | |
Merge branch 'add-mod-build-config' into develop
Diffstat (limited to 'src/StardewModdingAPI/Framework/Logging/LogFileManager.cs')
| -rw-r--r-- | src/StardewModdingAPI/Framework/Logging/LogFileManager.cs | 57 |
1 files changed, 0 insertions, 57 deletions
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 -{ - /// <summary>Manages reading and writing to log file.</summary> - internal class LogFileManager : IDisposable - { - /********* - ** Properties - *********/ - /// <summary>The underlying stream writer.</summary> - private readonly StreamWriter Stream; - - - /********* - ** Accessors - *********/ - /// <summary>The full path to the log file being written.</summary> - public string Path { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="path">The log file to write.</param> - 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 }; - } - - /// <summary>Write a message to the log.</summary> - /// <param name="message">The message to log.</param> - 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"); - } - - /// <summary>Release all resources.</summary> - public void Dispose() - { - this.Stream.Dispose(); - } - } -} |
