feat(logs): save every log in one zip for a bug report #354

Merged
HumanBean merged 3 commits from Jiro113/LongshotLauncher:journaux-zip into main 2026-11-28 21:52:06 +00:00
Contributor

The Logs page saves one log at a time, always as longshot-log.txt, so a bug report takes five to eight saves and as many renames by hand. This adds one button that saves every log in a single zip.

The Logs page with Save all logs

What changed

Save all logs (ui/logs.slint, ui/log-viewer.slint, src/logbook.rs)

  • A primary Save all logs button sits at the top of the sidebar, under the Logs title, with the hint Attach the zip to a bug report. It is disabled when the page lists no log. The only edit in the sidebar is these two items, between the title and LOCAL SESSIONS. The session list, SESSIONS and available() are unchanged.
  • It opens a save dialog proposing longshot-logs-YYYY-MM-DD-HHMM.zip (local time). The zip holds every file available() lists: the selected build's game logs and the launcher's. Each file keeps its own name, and an index.txt is added. The index gives the launcher version, the selected game's version tag (no folder name or path), when the zip was saved, and each file's size, modification time and label. Times are in UTC, as in launcher.log. A name already taken gets a 2- prefix (index.txt is reserved). A log that disappears between the list and the copy (rotation) is noted in the index instead of failing the whole zip. A log still being written (the launcher's own) is copied up to the size it had when its copy started. A log of 4 GiB or more is stored as a zip64 entry.
  • The zip is written on a worker thread, so a large game log doesn't freeze the window. It goes to a temporary file next to the destination, then is put in place, as Save a copy does. Errors go to the notice (Saving the logs: …). There is no confirmation on success, as with Save a copy. Nothing is uploaded: the zip stays on this PC, and the player decides whether to send it. The logs go in as they are on disk, as with Save a copy.

Save a copy proposes a name for the selected log instead of longshot-log.txt: its kind and the day it was last written, in local time. Examples: longshot-game-2026-11-28.txt, longshot-game-previous-…, longshot-build-…, longshot-launcher-…, longshot-play-shortcut-…. A log the list adds later keeps its own stem.

Other

  • players::zip_time is moved out of the save export (src/players/archive.rs) so both zips stamp their entries the same way. The code is unchanged.
  • game::selected_tag gives the index its game line.
  • The two new strings are translated in the 12 full catalogs. fr-CA adds rapport de bogue, as its other bug-report string does. scripts/translations.py validates all 15. Every translated label fits the narrowest sidebar: at 900 px it leaves 213 px for the button. Measured with the bundled Inter Bold at 15 px, plus padding, the widest is French Enregistrer les journaux at 194 px.
  • README: the Settings row mentions Save all logs.

Testing

  • Tested
    • New Rust tests in src/logbook.rs:
      • save_all_zips_every_listed_log_with_an_index: a temporary launcher home is zipped. The test checks the entries, their bytes and the index lines, that an unlisted file is left out, that the home's path is not in the index, and that no temporary file is left. It doesn't depend on the order of the session list.
      • save_all_refuses_an_empty_list_and_keeps_names_apart: an empty list is refused and leaves no file. It also covers duplicate names, a log named index.txt, and a missing log.
      • proposed_names_say_which_log_and_when.
    • The launcher on Windows 11, with a synthetic launcher home and a temporary hook that opened the Logs page (not committed): the screenshot above.
    • python -I tests/test_launcher_core.py: catalogs validated. cargo test: 188 passed, 11 failed. The same 11 tests fail on main (ed29aca) on this PC, where 185 pass: Windows-only failures in folders, recovery, registry, steam library, home, storage and release_py_fixture_verifies_exact_bytes_only. CI runs them on Linux.
    • cargo fmt --all -- --check and cargo clippy --locked --workspace --all-targets -- -D warnings: clean.
    • LAUNCHER=$PWD python -I ../Tooling/tests/test_release.py: 46 tests OK.
  • Still to test
    • The native save dialog itself, clicked through, on Windows and on Linux (the Steam Deck): the proposed names and the saved zip opening in the system's archive tool.
    • A zip with a built game selected, so that its game logs are in it. The tests run without a build, so available()'s game branch isn't covered.
    • The sidebar in a 900 px window in French, Spanish and German. The fit was measured with the font, not seen on screen.

🤖 Generated with Claude Code

The Logs page saves one log at a time, always as `longshot-log.txt`, so a bug report takes five to eight saves and as many renames by hand. This adds one button that saves every log in a single zip. ![The Logs page with Save all logs](https://git.magicbean.dev/attachments/a94248aa-2ed9-49aa-9128-9a81f6ec76ad) ## What changed **Save all logs** (`ui/logs.slint`, `ui/log-viewer.slint`, `src/logbook.rs`) - A primary **Save all logs** button sits at the top of the sidebar, under the *Logs* title, with the hint *Attach the zip to a bug report.* It is disabled when the page lists no log. The only edit in the sidebar is these two items, between the title and *LOCAL SESSIONS*. The session list, `SESSIONS` and `available()` are unchanged. - It opens a save dialog proposing `longshot-logs-YYYY-MM-DD-HHMM.zip` (local time). The zip holds every file `available()` lists: the selected build's game logs and the launcher's. Each file keeps its own name, and an `index.txt` is added. The index gives the launcher version, the selected game's version tag (no folder name or path), when the zip was saved, and each file's size, modification time and label. Times are in UTC, as in `launcher.log`. A name already taken gets a `2-` prefix (`index.txt` is reserved). A log that disappears between the list and the copy (rotation) is noted in the index instead of failing the whole zip. A log still being written (the launcher's own) is copied up to the size it had when its copy started. A log of 4 GiB or more is stored as a zip64 entry. - The zip is written on a worker thread, so a large game log doesn't freeze the window. It goes to a temporary file next to the destination, then is put in place, as *Save a copy* does. Errors go to the notice (*Saving the logs: …*). There is no confirmation on success, as with *Save a copy*. Nothing is uploaded: the zip stays on this PC, and the player decides whether to send it. The logs go in as they are on disk, as with *Save a copy*. **Save a copy** proposes a name for the selected log instead of `longshot-log.txt`: its kind and the day it was last written, in local time. Examples: `longshot-game-2026-11-28.txt`, `longshot-game-previous-…`, `longshot-build-…`, `longshot-launcher-…`, `longshot-play-shortcut-…`. A log the list adds later keeps its own stem. **Other** - `players::zip_time` is moved out of the save export (`src/players/archive.rs`) so both zips stamp their entries the same way. The code is unchanged. - `game::selected_tag` gives the index its game line. - The two new strings are translated in the 12 full catalogs. `fr-CA` adds *rapport de bogue*, as its other bug-report string does. `scripts/translations.py` validates all 15. Every translated label fits the narrowest sidebar: at 900 px it leaves 213 px for the button. Measured with the bundled Inter Bold at 15 px, plus padding, the widest is French *Enregistrer les journaux* at 194 px. - README: the Settings row mentions *Save all logs*. ## Testing - **Tested** - New Rust tests in `src/logbook.rs`: - `save_all_zips_every_listed_log_with_an_index`: a temporary launcher home is zipped. The test checks the entries, their bytes and the index lines, that an unlisted file is left out, that the home's path is not in the index, and that no temporary file is left. It doesn't depend on the order of the session list. - `save_all_refuses_an_empty_list_and_keeps_names_apart`: an empty list is refused and leaves no file. It also covers duplicate names, a log named `index.txt`, and a missing log. - `proposed_names_say_which_log_and_when`. - The launcher on Windows 11, with a synthetic launcher home and a temporary hook that opened the Logs page (not committed): the screenshot above. - `python -I tests/test_launcher_core.py`: catalogs validated. `cargo test`: 188 passed, 11 failed. The same 11 tests fail on `main` (ed29aca) on this PC, where 185 pass: Windows-only failures in folders, recovery, registry, steam library, home, storage and `release_py_fixture_verifies_exact_bytes_only`. CI runs them on Linux. - `cargo fmt --all -- --check` and `cargo clippy --locked --workspace --all-targets -- -D warnings`: clean. - `LAUNCHER=$PWD python -I ../Tooling/tests/test_release.py`: 46 tests OK. - **Still to test** - The native save dialog itself, clicked through, on Windows and on Linux (the Steam Deck): the proposed names and the saved zip opening in the system's archive tool. - A zip with a built game selected, so that its game logs are in it. The tests run without a build, so `available()`'s game branch isn't covered. - The sidebar in a 900 px window in French, Spanish and German. The fit was measured with the font, not seen on screen. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The Logs page gains a primary "Save all logs" button under its title. It
saves one zip, longshot-logs-YYYY-MM-DD-HHMM.zip, with every log the page
lists under its own file name and an index.txt naming the launcher version,
the selected game and each file's size and modification time. It is written
through a temporary file and stays on this PC.

"Save a copy" now proposes a name for the selected log, such as
longshot-game-2026-11-28.txt, from its kind and the day it was last written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(logs): keep the log zip's index in UTC, off the window's thread, and fitting narrow windows
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Blocked by required conditions
CI / Rust formatting, lint and tests (pull_request) Blocked by required conditions
CI / Release packages and stable upgrades (pull_request) Blocked by required conditions
PR title / Conventional Commit title (pull_request) Blocked by required conditions
0e00c67667
- index.txt gives times in UTC, as the launcher's own log does, and names
  the selected version by its tag only (no build folder name).
- index.txt and a log with no modification time get a real date in the
  zip, not 1980; a log of 4 GiB or more is written as a large file.
- The zip is written on a worker thread, so a large game log does not
  freeze the window; an error still goes to the notice.
- "Save a copy" names a log the list does not know yet after its stem.
- Shorter French and Spanish labels fit the 900 px window's sidebar.
- The tests no longer depend on the session list's order and check
  that no temporary file is left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

The Logs page with Save all logs and its hint, on Windows 11 with a synthetic launcher home (no real logs):

The Logs page with Save all logs

The Logs page with **Save all logs** and its hint, on Windows 11 with a synthetic launcher home (no real logs): ![The Logs page with Save all logs](https://git.magicbean.dev/attachments/a94248aa-2ed9-49aa-9128-9a81f6ec76ad)
Member

Possibly related, for context:

  • PR #171 feat(log): the launcher's log kept in a file, with the run before, its crashes and what it did to the player's data — Introduced persistent launcher log files now included by this export
Possibly related, for context: - PR #171 feat(log): the launcher's log kept in a file, with the run before, its crashes and what it did to the player's data — Introduced persistent launcher log files now included by this export
HumanBean deleted branch journaux-zip 2026-11-28 21:52:06 +00:00
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Blocked by required conditions
CI / Rust formatting, lint and tests (pull_request) Blocked by required conditions
CI / Release packages and stable upgrades (pull_request) Blocked by required conditions
PR title / Conventional Commit title (pull_request) Blocked by required conditions
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!354
No description provided.