Files
BSO-Launcher/Services/LauncherLog.cs
T
MrMahoandClaude Opus 5.5 b69b9638ff Erste Version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:26:25 +01:00

27 lines
926 B
C#

namespace BSO.Launcher;
/// <summary>Protokoll des Launchers: %LocalAppData%\BSO Launcher\launcher.log (wird beim Start ab 1 MB neu begonnen).</summary>
public static class LauncherLog
{
static readonly object Gate = new();
public static string FilePath => Path.Combine(Settings.Folder, "launcher.log");
public static void Info(string line) => Write("INFO ", line);
public static void Error(string line) => Write("ERROR", line);
static void Write(string level, string line)
{
lock (Gate)
{
try
{
Directory.CreateDirectory(Settings.Folder);
var info = new FileInfo(FilePath);
if (info.Exists && info.Length > 1024 * 1024) info.Delete();
File.AppendAllText(FilePath, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {level} {line}{Environment.NewLine}");
}
catch { }
}
}
}