Logging and diagnostics
Code: src-tauri/src/diagnostics/. A bundled app has no console, so the backend keeps its own log.
Log file
xhape.log lives in the app's log folder (Tauri's app_log_dir, identifier app.xhape.desktop):
| OS | Folder |
|---|---|
| Linux | ~/.local/share/app.xhape.desktop/logs/ |
| macOS | ~/Library/Logs/app.xhape.desktop/ |
| Windows | %LOCALAPPDATA%\app.xhape.desktop\logs\ |
- One line per event,
2026-11-06T12:34:56.789Z INFO message, UTC, written and flushed at once so a crash loses nothing. - Size limit: at 1 MiB the file moves to
xhape.1.log(older ones toxhape.2.log...xhape.4.log, the oldest is dropped), so the logs never take more than about 5 MiB. - Age limit: rotated files older than 14 days are deleted when the app starts.
- Level
info;XHAPE_LOG=debug(orwarn, ...) before starting the app changes it. Libraries only log warnings and errors. - If the folder cannot be used the app runs without a log and prints one line to stderr.
What is logged
App start (version, OS, architecture); a panic (message and place); project new / open / import audio / save / delete; every error a project command returns; output start with the resolved devices as JSON (OutputInfo without the warnings) and each warning; output stop; transport state changes with the frame; an audio or LTC device lost; a device that renders faster than real time; the show ending; and fault counts.
Faults and the audio threads
Audio callbacks must not allocate or wait, so they never log. The stream error callbacks, xhape-mtc, xhape-midi and xhape-osc count into SharedClock::faults:
| Counter | Counts |
|---|---|
xruns | cpal::ErrorKind::Xrun: the device under- or overran its buffer, heard as a dropout. The device stays in use. |
stream_errors | Every other stream error. The device is marked lost. |
mtc_errors | MIDI messages that could not be sent. |
cue_errors | Messages of the MIDI and OSC cue tracks that could not be sent (xhape-midi, xhape-osc). |
The xhape-log lane (diagnostics/lane.rs) compares them every ~33 ms and writes one line at most each second, e.g. 3 audio dropouts, 1 MIDI messages not sent. cpal has no counter for late callbacks beyond Xrun; the existing real-time pace check (clock_unpaced) covers a device that runs ahead of the clock.
Streamed sound
The sound of the VJ grid's clips is read from their files while it plays (xhape-sound thread, vj_stream.rs). The audio callback only counts the reads that found their one-second block not loaded yet (and played silence for), and the xhape-log lane writes one line, at most each second, when that count grew or the memory of the blocks changed by 16 MiB or more: VJ sound streaming: 3 blocks late (5 in total), 40 MiB of blocks in memory. Blocks late on a fast scrub are expected; on steady playback they point at a slow disk or network drive.
Help menu
| Item | Command | Does |
|---|---|---|
| Open log folder | diagnostics_open_log_dir | Opens the log folder in the system's file manager. |
| Export diagnostics… | diagnostics_export(path) | Writes a zip to path (the UI asks with the save dialog): report.txt and every log file. |
report.txt holds the app version, OS, export time, log folder, the graphics settings (what is saved and what this run started the webview with), the audio devices and the MIDI output and input ports the system lists, and the OutputInfo of the running output (or not running). The zip is written to a temporary file and renamed, so a failed export leaves any file already there as it was.