Logging and Diagnostics
Relevant source files
The following files were used as context for generating this wiki page:
Logging and Diagnostics in WebLaunch provides a system for capturing application events, handling exceptions, and generating detailed troubleshooting reports. The system records runtime information to local log files and console windows to assist developers and users in identifying issues during game updates and launches.
The diagnostics framework includes specialized troubleshooting payloads that capture system state, version information, and configuration settings. These payloads are often encoded for parseable logging, allowing support teams to reconstruct the exact environment of a failure.
Logging Architecture
The project uses multiple logging providers, including Serilog, log4net, and custom console redirectors. This multi-layered approach ensures that information is captured regardless of whether the application is running in a headless state or with a visible user interface.
Logging Components
- Serilog: Captures high-level application flow and structured troubleshooting data.
- log4net: Used within game-specific handlers like
SpellbornSupporterfor internal logic tracing. - Console Redirection: The
ConsoleOutputRedirectorclass intercepts standard console output and writes it to a graphical UI component (Window1). - File Logging: Application events are persisted to a
debug.logfile in the application's base directory.
Sources: handlerlaunch/Program.cs:466-473, handlerlaunch/SupportObjects.cs:150-155, SpinningWheelLib/Window1.xaml.cs:51-68
Console Output Flow
This diagram illustrates how console output is simultaneously handled by the application for display and persistence.
Exception Handling and Troubleshooting
The Troubleshooting class serves as the central hub for error reporting. It captures the last occurring exception and generates a Base64 encoded JSON payload containing comprehensive system metadata.
Troubleshooting Payloads
The diagnostic system generates a TroubleshootingPayload containing the following environment data:
- System Info: Platform type (Win32, Mac, Linux), DPI awareness, and timestamps.
- Launcher State: Version, hash, and whether it is an official build.
- Game Integrity: Version strings for various game repositories (Boot, Ffxiv, Ex1-Ex4) and backup match status.
- Dalamud Configuration: Injection delay, load method, and enabled features.
Sources: CoreLibLaunchSupport/Troubleshootthing.cs:134-177
Diagnostic Logic Table
| Component | Description | Data Captured |
|---|---|---|
LogException | Serializes exceptions with context. | Timestamp, Stack Trace, Context string. |
LogTroubleshooting | Logs the full state of the game and launcher. | Versions, Platform, Integrity results. |
RepoExtensions | Analyzes game file structures. | .ver and .bck version strings. |
Sources: CoreLibLaunchSupport/Troubleshootthing.cs:178-212, CoreLibLaunchSupport/Troubleshootthing.cs:13-74
Integrity and Update Monitoring
The DalamudUpdater and IntegrityCheck modules provide diagnostic verification for game assets and injection hooks. These components log specific prefixes like [DUPDATE] and [DASSET] to categorize log entries.
Update Diagnostic Process
- Version Fetching: The updater logs the bucket (Canary/Control) and track (Staging/Release) being used.
- Integrity Validation: The system calculates MD5 or SHA1 hashes of local files and compares them against a remote
hashes.json. - Failure Reporting: Any mismatch in hashes or failure to download assets is logged as an
Errorlevel event with the specific file path involved.
Diagnostic UI Features
The Window1 component in SpinningWheelLib provides a real-time console view for users. It supports expanding/collapsing a console log area and allows the application to write color-coded messages directly to the UI.
- Console Redirection: Methods like
WriteToConsoleuse the WPF Dispatcher to ensure thread-safe updates to the logging UI. - Progress Tracking: The UI diagnostics include progress percentages and step descriptions (e.g., "Checking game files...", "Verifying credentials...") derived from background tasks.
Sources: SpinningWheelLib/Window1.xaml.cs:176-193, handlerlaunch/Program.cs:266-281
Conclusion
Logging and Diagnostics in WebLaunch ensure that every stage of the game launch—from registry manipulation and version checking to DLL injection—is transparent. By combining structured JSON troubleshooting payloads with real-time console redirection, the system provides both human-readable logs for users and machine-parseable data for automated support analysis.
Sources: CoreLibLaunchSupport/Troubleshootthing.cs:181-197, handlerlaunch/Program.cs:411-420