aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs')
-rw-r--r--src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs b/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs
index 2cc4a823..8d1a94e5 100644
--- a/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs
+++ b/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs
@@ -7,9 +7,9 @@ namespace Ryujinx.Common.Logging.Targets
{
public class FileLogTarget : ILogTarget
{
- private readonly StreamWriter _logWriter;
+ private readonly StreamWriter _logWriter;
private readonly ILogFormatter _formatter;
- private readonly string _name;
+ private readonly string _name;
string ILogTarget.Name { get => _name; }
@@ -20,7 +20,7 @@ namespace Ryujinx.Common.Logging.Targets
public FileLogTarget(string path, string name, FileShare fileShare, FileMode fileMode)
{
// Ensure directory is present
- DirectoryInfo logDir = new DirectoryInfo(Path.Combine(path, "Logs"));
+ DirectoryInfo logDir = new(Path.Combine(path, "Logs"));
logDir.Create();
// Clean up old logs, should only keep 3
@@ -33,9 +33,9 @@ namespace Ryujinx.Common.Logging.Targets
string version = ReleaseInformation.GetVersion();
// Get path for the current time
- path = Path.Combine(logDir.FullName, $"Ryujinx_{version}_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.log");
+ path = Path.Combine(logDir.FullName, $"Ryujinx_{version}_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.log");
- _name = name;
+ _name = name;
_logWriter = new StreamWriter(File.Open(path, fileMode, FileAccess.Write, fileShare));
_formatter = new DefaultLogFormatter();
}
@@ -48,6 +48,7 @@ namespace Ryujinx.Common.Logging.Targets
public void Dispose()
{
+ GC.SuppressFinalize(this);
_logWriter.WriteLine("---- End of Log ----");
_logWriter.Flush();
_logWriter.Dispose();