feat(gui): Keep each session's operation log on disk - #109
Merged
Merged
Conversation
The operation log (the [Country], [ADB], [Flash] lines) was archived in an anonymous temp file that vanished when LTBox closed. After a failed operation the only trace left was ltbox.log, which carries third-party records but none of LTBox's own lines, so a failure could not be read back unless the user had pressed Save Log in time. The archive now also mirrors into logs/sessions/session-<local time>.log next to ltbox.log, seeded with the lines logged before the mirror opened. Clearing the on-screen log keeps writing to the same file. The 30 newest sessions are kept; older ones are removed when a new session starts. A write error drops the mirror without touching the in-memory transcript or export. Demo mode stays off disk.
Flush the current progress before handing the session mirror to an empty history. Cover sampled progress and repeated clears without duplicate lines. Co-authored-by: GPT-6 Astra <noreply@openai.com>
Keep the shared log directory helper alongside the merged iced logging filter. Preserve the session progress flush on Clear Log. Co-authored-by: GPT-6 Astra <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The operation log (
[Country] …,[ADB] …,[Flash] …) lives inLogHistory, whose archive is an anonymoustempfile(). It disappears when LTBox exits.ltbox.logonly carriestracingrecords from dependencies, not LTBox's own operation lines. So once the app is closed, a failed operation leaves no readable trace unless the user pressed Save Log beforehand.This came up diagnosing a Change Country Code attempt: nothing in
ltbox.log, no backup folder, no way to tell which gate stopped it.Change
LogHistory::persist_to(dir, stamp)mirrors every archived line intologs/sessions/session-YYYY-MM-DD_HH-MM-SS.log(next toltbox.log), seeded with whatever was archived before the mirror opened (the "Ready" line).App::newturns it on for real sessions.App::default(), used by tests, and demo mode stay in memory only.LogHistory::cleared(), which first flushes pending progress and then hands the session file to the fresh history, so clearing the screen does not end the on-disk transcript.session-*.logfiles are kept, and older ones are removed when a new session starts. Other files in the folder are left alone.log_dir()is factored out ofinit_tracingso both use the same folder (same%TEMP%\ltbox-logsfallback for a missing or non-UTF-8 config dir).Same content as Save Log, including
[Debug]lines and the 5-second progress samples.Testing
cargo test -p ltbox-guiandcargo clippy -p ltbox-gui --all-targets --features demopass.Follow-up validation on Windows: workspace clippy with warnings denied, workspace tests, and
cargo deny --locked checkall pass.