| 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 { } | |
| } | |
| } | |