finder-wpf / FastSeekWpf /Core /Logger.cs
anshdadhich's picture
Upload FastSeekWpf/Core/Logger.cs
b0d361b verified
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 { }
}
}