Desktop: write log records to standard error and a rotating log file

A launch from the Dock, the Start menu or a launcher has no terminal, and
without RUST_LOG nothing reached standard error anyway, so start-up and
GPU warnings were lost unless Help > Enable Logging was already on.

The logger now writes EffectCraft's info records and everyone's warnings
to standard error and to Logs/effectcraft.log in the settings folder.
Each launch keeps the previous two runs' logs; the file is capped at
16 MiB. RUST_LOG still overrides the filter. Help > Reveal Logging File
shows this run's log unless Enable Logging is on.

Ported from storytold/pdfcraft#239.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fabio Lussi
2026-10-11 22:37:27 +02:00
co-authored by Claude Opus 5.5
parent 67434e9038
commit 16d9d7d30b
6 changed files with 347 additions and 39 deletions
+14
View File
@@ -223,3 +223,17 @@ checkpoint after a client restart.
Commands: `file.autoSave` (now), `file.recoveryInfo`, `file.openRecent {index? | path?}`,
`file.clearRecent`, `file.revert`, `file.incrementAndSave`.
## Logs
The desktop app writes its log records to standard error and to `Logs/effectcraft.log` in the
config directory. Each launch moves the previous log to `effectcraft.1.log` (and that one to
`effectcraft.2.log`), so the log of a run that crashed survives the next start; a log stops
growing at 16 MiB. A launch from the Dock, the Start menu or a launcher has no terminal, so
attach these files to a bug report. Help ▸ Reveal Logging File shows this run's log (or Help ▸
Enable Logging's `EffectCraft Log.txt` while that is on, which keeps every EffectCraft record
across launches).
By default the log has `info` records from EffectCraft and warnings and errors from everything
else. `RUST_LOG` replaces that with env_logger-style directives: `debug`,
`warn,effectcraft_render=trace`, `wgpu_core=info`. The control-channel token is never logged.