enhancement(logging): Frontend errors to file, safer paths, and copy log excerpt #159

Closed
opened 2026-08-31 00:06:46 +01:00 by gronod · 0 comments
Owner

Description

Host and Argyll subprocess lines already go to iccery.log. Three support gaps remain:

  1. Frontend — many failures only use console.error / console.warn (app.js init, chartread/targen invoke errors, settings load/save). Webview log forwarding is not a reliable support contract.
  2. Sensitive paths — spawn lines at info often include full home-directory cwd/args; awkward when users paste logs.
  3. Excerpt for supportCopy Path exists; copying the last N lines of the log does not.

Scope

A. Frontend → file

  • Small helper (logError / logWarn) that writes to console and forwards to Rust (tauri-plugin-log JS API or a thin log_message(level, msg) command).
  • Wire high-value paths first: safeInit failures, instrument detection, major invoke failures in stage modules and settings.
  • Avoid per-swatch / high-frequency UI noise.
  • Add log plugin permissions to capabilities/default.json if required.

B. Path handling in subprocess logs

  • At info, shorten or tilde-prefix home paths on spawn/cwd lines.
  • Keep full paths at debug/trace for local diagnosis.
  • Do not change paths passed to Argyll — logging only.

C. Copy recent excerpt

  • Settings action: Copy recent log lines (e.g. last 100–200 lines or last ≤64 KiB).
  • Backend reads the active log with a size cap; frontend copies to clipboard.
  • Feedback: “Copied N lines” / empty / missing file.

Acceptance Criteria

  • A forced UI/invoke failure appears in iccery.log, not only DevTools.
  • Default info spawn lines are less likely to expose raw home prefixes.
  • User can copy a recent log excerpt from Settings without opening the file externally.
  • Large logs are not fully loaded into memory when copying.

Dependencies

  • Independent of #158 (level apply), but more useful once levels work.
  • Builds on existing get_log_path / app_log_dir layout from #139.
### Description Host and Argyll subprocess lines already go to `iccery.log`. Three support gaps remain: 1. **Frontend** — many failures only use `console.error` / `console.warn` (`app.js` init, chartread/targen invoke errors, settings load/save). Webview log forwarding is not a reliable support contract. 2. **Sensitive paths** — spawn lines at `info` often include full home-directory cwd/args; awkward when users paste logs. 3. **Excerpt for support** — **Copy Path** exists; copying the **last N lines** of the log does not. ### Scope #### A. Frontend → file - Small helper (`logError` / `logWarn`) that writes to console and forwards to Rust (`tauri-plugin-log` JS API or a thin `log_message(level, msg)` command). - Wire high-value paths first: `safeInit` failures, instrument detection, major `invoke` failures in stage modules and settings. - Avoid per-swatch / high-frequency UI noise. - Add log plugin permissions to `capabilities/default.json` if required. #### B. Path handling in subprocess logs - At `info`, shorten or tilde-prefix home paths on spawn/cwd lines. - Keep full paths at `debug`/`trace` for local diagnosis. - Do not change paths passed to Argyll — logging only. #### C. Copy recent excerpt - Settings action: **Copy recent log lines** (e.g. last 100–200 lines or last ≤64 KiB). - Backend reads the active log with a size cap; frontend copies to clipboard. - Feedback: “Copied N lines” / empty / missing file. ### Acceptance Criteria - [ ] A forced UI/`invoke` failure appears in `iccery.log`, not only DevTools. - [ ] Default `info` spawn lines are less likely to expose raw home prefixes. - [ ] User can copy a recent log excerpt from Settings without opening the file externally. - [ ] Large logs are not fully loaded into memory when copying. ### Dependencies - Independent of #158 (level apply), but more useful once levels work. - Builds on existing `get_log_path` / `app_log_dir` layout from #139.
gronod added the Kind/Enhancement
Reviewed
Confirmed
1
Priority
Medium
3
labels 2026-08-31 00:06:46 +01:00
gronod added this to the Milestone 10: Production Ready Features (v0.6.0) milestone 2026-08-31 00:08:44 +01:00
Sign in to join this conversation.