Upload FastSeekWpf/Core/Logger.cs
Browse files- FastSeekWpf/Core/Logger.cs +25 -0
FastSeekWpf/Core/Logger.cs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.IO;
|
| 3 |
+
|
| 4 |
+
namespace FastSeekWpf.Core;
|
| 5 |
+
|
| 6 |
+
public static class Logger
|
| 7 |
+
{
|
| 8 |
+
private static readonly string LogPath = Path.Combine(
|
| 9 |
+
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
| 10 |
+
"FastSeek", "log.txt");
|
| 11 |
+
|
| 12 |
+
static Logger()
|
| 13 |
+
{
|
| 14 |
+
Directory.CreateDirectory(Path.GetDirectoryName(LogPath)!);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
public static void Log(string message)
|
| 18 |
+
{
|
| 19 |
+
try
|
| 20 |
+
{
|
| 21 |
+
File.AppendAllText(LogPath, $"[{DateTime.Now:HH:mm:ss.fff}] {message}{Environment.NewLine}");
|
| 22 |
+
}
|
| 23 |
+
catch { }
|
| 24 |
+
}
|
| 25 |
+
}
|