Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SystemLog #222

Merged
merged 7 commits into from
Apr 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/SystemLog/Logger.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Text;
using static System.IO.Path;

namespace Neo.Plugins
Expand Down Expand Up @@ -39,6 +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, '-');
erikzhang marked this conversation as resolved.
Show resolved Hide resolved
shargon marked this conversation as resolved.
Show resolved Hide resolved
var path = Combine(Settings.Default.Path, source);
shargon marked this conversation as resolved.
Show resolved Hide resolved
Directory.CreateDirectory(path);
path = Combine(path, $"{now:yyyy-MM-dd}.log");
Expand Down