mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
The desktop app installed no logger, so every log::warn!/log::error! in the workspace was discarded: the graphics adapter in use, a lost graphics device, the engine guard's report of a recovered panic. A launch from a desktop menu has no terminal either, so there was nothing to attach to a bug report. apps/vectorcraft/src/logging.rs (no new dependency): - standard error plus logs/vectorcraft.log next to the preferences (~/.config/vectorcraft/logs, or under $XDG_CONFIG_HOME); each launch rotates the previous log to vectorcraft.1.log and .2.log, so the log of a run that crashed survives the next start; the file is capped at 16 MiB - records logged before the settings directory is known are buffered (bounded) and written once the file is attached - default levels: info for vectorcraft*, warn for everything else; RUST_LOG replaces them with env_logger-style directives - never panics: an unusable directory or a failed write leaves standard error as the only sink - runs with VECTORCRAFT_NO_PREFS (agents' test runs) log to standard error only, so they don't rotate away the user's own logs The logger is installed first in main and the file is opened after argument parsing (--version leaves no file). Log messages of this crate drop their "vectorcraft: " prefix, which the record's target now shows. vectorcraft-cli keeps its own MCP logger (vectorcraft_mcp::logging). Documented in docs/development.md (Logs, Environment variables).