Skip to content

13 logging and debug

drpetersonfernandes edited this page Aug 6, 2026 · 1 revision

13 — Logging & Debug

Serilog setup, sinks, the Debug Window, and bug-reporting. Related: 04 — Architecture · 08 — UI Layer

Serilog bootstrap

Serilog 4.4.0 (+ Serilog.Sinks.Async 2.1.0, Serilog.Sinks.Debug 3.0.0, Serilog.Sinks.File 7.0.0) is configured in App.OnStartup (App.xaml.cs:117-137):

  • File sink: rolling daily file in the local app-data folder (%LocalAppData%\SimpleLauncher\error_user.log by default, or LogPath override), 7 days retained.
  • DebugWindowSink: pushes log events to the live Debug Window (buffered; flushed when the window connects).
  • BugReportApiSink: queues events for the bug-report API (see below).
  • Fallback: if Serilog initialization fails, the app falls back to debug output instead of crashing.

ILogger (Serilog) is injected everywhere — Core and app projects both have a global using Serilog; (see 02 — Projects & Solution).

Debug Window

  • DebugWindow (app): singleton live log viewer; closing hides the window instead of destroying it; logging continues; reopening flushes the buffered history.
  • Launched via the tray menu / Help menu, or automatically with the -debug command-line flag (opens alongside the main window).
  • IDebugLogger (legacy abstraction) and NoOpDebugLogger (fallback) still exist for compatibility; new code uses Serilog ILogger directly.

Bug report pipeline

BugReportApiSink (SimpleLauncher.Core\Services\DebugAndBugReport\BugReportApiSink.cs):

  1. Log events are queued (bounded — warnings do not grow unbounded, ~100-cap) and submitted to the bug-report API.
  2. On success: queued logs are deleted.
  3. On failure: critical_error.log (or error.log / error_user.log) is written locally with environment details; WindowsVersionService/GetMicrosoftWindowsVersion supply OS info for reports.

The Support Window (SupportWindow + SupportViewModel) is the user-facing entry point: name/email/message validation, "Sending support request…" overlay, POST to the support API, and an emergency return button on the overlay.

Log locations summary

Path Content
%LocalAppData%\SimpleLauncher\error_user.log rolling daily log (7 days)
%LocalAppData%\SimpleLauncher\error.log error-level log
%LocalAppData%\SimpleLauncher\critical_error.log written when the bug-report API is unreachable
Debug Window (in-app) live stream via DebugWindowSink

Related docs

Clone this wiki locally