- Rename solution files: TeamsISO.sln/slnf -> Dragon-ISO.sln/slnf - Rename all src/TeamsISO.* directories and project files to src/Dragon-ISO.* equivalents - Update .gitignore to exclude build/test output logs - Update ci.yml, CHANGELOG.md, build-and-test.ps1, docs references Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using System.IO;
|
|
|
|
namespace DragonISO.App;
|
|
|
|
/// <summary>
|
|
/// Bare-metal startup tracer that opens, appends, and closes a file on
|
|
/// every call. Used to capture what's happening BEFORE Serilog comes up
|
|
/// (and to capture failures that would prevent Serilog from coming up at
|
|
/// all). Failures here are swallowed — we never want diagnostics to crash
|
|
/// the very thing we're trying to diagnose.
|
|
///
|
|
/// File lives at <c>%LOCALAPPDATA%\Dragon-ISO\startup-trace.log</c>. Grows
|
|
/// without rotation; expected to be tiny since each launch writes ~20
|
|
/// lines. Acceptable cost for catching launch-time regressions.
|
|
/// </summary>
|
|
internal static class StartupTrace
|
|
{
|
|
private static readonly object _gate = new();
|
|
|
|
public static void Write(string message)
|
|
{
|
|
try
|
|
{
|
|
var dir = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
|
"Dragon-ISO");
|
|
Directory.CreateDirectory(dir);
|
|
var path = Path.Combine(dir, "startup-trace.log");
|
|
var line = $"[{DateTimeOffset.Now:yyyy-MM-dd HH:mm:ss.fff}] [PID {Environment.ProcessId}] {message}{Environment.NewLine}";
|
|
lock (_gate)
|
|
{
|
|
File.AppendAllText(path, line);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
// Diagnostics must NEVER crash startup.
|
|
}
|
|
}
|
|
}
|