Skip to content

Commit

Permalink
Fix StringBuilder returns
Browse files Browse the repository at this point in the history
StringBuilder.Replace returns a new StringBuilder
  • Loading branch information
shargon committed Apr 15, 2020
1 parent eeb3e6e commit 9d93ab2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/SystemLog/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ void ILogPlugin.Log(string source, LogLevel level, string message)

if (!string.IsNullOrEmpty(Settings.Default.Path))
{
StringBuilder sb = new StringBuilder(source);
foreach (char c in GetInvalidFileNameChars())
sb.Replace(c, '-');
var path = Combine(Settings.Default.Path, sb.ToString());
source = source.Replace(c, '-');
var path = Combine(Settings.Default.Path, source);
Directory.CreateDirectory(path);
path = Combine(path, $"{now:yyyy-MM-dd}.log");
File.AppendAllLines(path, new[] { $"[{level}]{log}" });
Expand Down

0 comments on commit 9d93ab2

Please sign in to comment.