Skip to content

VICTORY_LOG_FILE: append a run's log to a file - #12

Merged
MagiccConch merged 1 commit into
mainfrom
log-file
Nov 25, 2026
Merged

MagiccConch merged 1 commit into
mainfrom
log-file

Conversation

@MagiccConch

Copy link
Copy Markdown
Owner

What changed

Set VICTORY_LOG_FILE=<path> and every log record is appended to that file alongside the console output.

$env:VICTORY_LOG_FILE = "C:\Users\Who\VIctory\victory-run.log"
target\release\victory.exe run <exe> --execute

Why

A title run's diagnosis lives in its console output, which is gone when the window closes or the machine reboots. crashes.log only appears on an unhandled exception, so a clean-looking run leaves no trace to read afterwards. With a log file, the whole run (device creation, the view-heap cap line, heap warnings, HLE blocks) is on disk for review and comparison across runs.

How

  • victory-core/src/logging.rs: a second fmt layer with a file writer (shared Arc<Mutex<File>> handle, opened append+create, flushed per record — each record lands whole even with worker threads logging concurrently).
  • An unusable path warns (once the subscriber is live, so it is visible) and the run continues console-only.
  • The env-reading stays in init; tests drive the new env-less init_with (Rust 2024 makes set_var unsafe, and parallel tests must not race on environment variables).
  • README documents the variable next to VICTORY_LOG.

Tests

  • file_log_appends: writes append, a later writer keeps earlier content (no truncation across runs).
  • file_log_unusable: a path whose parents do not exist logs nothing to a file and does not panic.

cargo test -p victory-core, cargo clippy -p victory-core --all-features --all-targets on x86_64-pc-windows-gnu: clean.


This PR was created by an AI agent (OpenHands) on behalf of the user.

A second fmt layer appends every record to the file the env var names,
alongside the console, so a run's output survives the window closing.
Opened for appending, flushed per record; an unusable path is warned
about and the run continues on the console alone.

Co-authored-by: openhands <openhands@all-hands.dev>
@MagiccConch
MagiccConch merged commit be3f4ce into main Nov 25, 2026
1 check passed
@MagiccConch
MagiccConch deleted the log-file branch November 25, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants