File size: 757 Bytes
a18d4fd b0d361b a18d4fd b0d361b a18d4fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | using System;
using System.IO;
namespace FastSeekWpf.Core;
public static class Logger
{
private static readonly string LogPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"FastSeek", "log.txt");
static Logger()
{
Directory.CreateDirectory(Path.GetDirectoryName(LogPath)!);
}
public static void Log(string message)
{
string line = $"[{DateTime.Now:HH:mm:ss.fff}] {message}{Environment.NewLine}";
try
{
File.AppendAllText(LogPath, line);
}
catch { }
try
{
// Also write to console if available (CLI mode)
Console.Error.Write(line);
}
catch { }
}
}
|