-
Notifications
You must be signed in to change notification settings - Fork 5
13 logging and debug
Serilog setup, sinks, the Debug Window, and bug-reporting. Related: 04 — Architecture · 08 — UI Layer
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.logby default, orLogPathoverride), 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).
-
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
-debugcommand-line flag (opens alongside the main window). -
IDebugLogger(legacy abstraction) andNoOpDebugLogger(fallback) still exist for compatibility; new code uses SerilogILoggerdirectly.
BugReportApiSink (SimpleLauncher.Core\Services\DebugAndBugReport\BugReportApiSink.cs):
- Log events are queued (bounded — warnings do not grow unbounded, ~100-cap) and submitted to the bug-report API.
- On success: queued logs are deleted.
- On failure:
critical_error.log(orerror.log/error_user.log) is written locally with environment details;WindowsVersionService/GetMicrosoftWindowsVersionsupply 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.
Project policy: expected environment/user conditions are logged at Information, never Warning/Error, so they are not forwarded to the bug-report API. Current examples:
-
Audio — missing
libsndfile/libasound, no usable audio device, or a corrupt/unsupported sound file (PlaySoundEffects.IsExpectedPlaybackFailure; MP3/WAV use managed decoders, so the built-in sounds work without native packages). - Mounting — mounting Windows-only disc/archive images ("not supported on this platform") on Linux/macOS.
- Launching — invalid/unlaunchable executables (Windows codes 193/216, Unix errno 8/13) and user-canceled elevation prompts.
- Updates — GitHub 403/429, download timeouts after retry, updater "process not found", a GitHub release without assets for the current platform (LB-23).
-
Settings database — a
settings.datwritten by a newer app build (downgrade): migration and saves fail safe at Information, leaving the database and the legacy files untouched (NewerSchemaVersionException). - Files — missing files on launch/delete.
| 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
|
- 04 — Architecture (startup sequence)
- 08 — UI Layer (Debug Window, status bar)
- 14 — Testing (log-related tests)
- Home
- 01 Overview
- 02 Projects And Solution
- 03 Quickstart
- 04 Architecture
- 05 Configuration
- 06 Systems And Launch
- 07 Core Services
- 08 Ui Layer
- 09 Retroachievements
- 10 Game Scanning
- 11 Bundled Tools
- 12 Data Formats
- 13 Logging And Debug
- 14 Testing
- 15 Development
- 16 Updater
- 17 Release Notes
- 18 Emulator Parameters
- Gui Test Harness
- Manual Tests
- Parameters