core: add VICTORY_LOG_FILE and terminal-only stderr colour #2227
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2227
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2227"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sidlik900 on GitHub · 2026-11-25 08:23 UTC · original
Sidlik900:core/victory-log-file→main· +474 −23 · 7 files · 2 commits · openFollows up on the released
VICTORY_LOG_FILEtask in #1633.Summary
VICTORY_LOG_FILE=<file>support incrates/victory-core/src/logging.rsto mirror logs as plain, unwrapped UTF-8 lines without ANSI escape sequences (creating missing parent directories and warning on open failure without panicking).stderronly when connected to a terminal (IsTerminal), honouringNO_COLORandCLICOLOR_FORCE.VICTORY_LOG_FILE,NO_COLOR, andCLICOLOR_FORCEinREADME.md.victory-core(no game files required).Verification
cargo xtask policycargo test -p victory-core --locked(19 passed)cargo test -p victory-core --all-features --locked(19 passed)cargo test -p xtask -p victory --locked(all passed)cargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningsAI-assisted (Antigravity); synthetic unit tests only, no game data.
@Dathinel on GitHub · 2026-11-25 08:41 UTC · original
The audio recorder child can truncate the parent’s log. On
e25d2ae, main initializes logging before checking capture::child(), and capture::start() spawns current_exe() with the parent environment. Consequently both processes call File::create on the same VICTORY_LOG_FILE.I reproduced the logging path on Windows with VICTORY_LOG=info: initialize in a parent, log BEFORE, spawn and wait for a child that initializes and logs CHILD, then log AFTER. Redirected stderr contained all three markers. The file contained CHILD, eight NUL bytes, then AFTER; BEFORE was gone. Running the parent without spawning preserved both parent lines. This used the public logging initializer and synthetic messages, without starting audio capture.
Could the recorder inherit a separate destination or skip the mirror if only the parent should own the per-run file? A two-process regression would cover this separately from the existing thread test. AI-assisted validation.
@Sidlik900 on GitHub · 2026-11-25 09:51 UTC · original
Good catch, @Dathinel — thank you for reproducing and explaining that clearly. Fixed in
5aebbc4so only the parent process ownsVICTORY_LOG_FILE:Changes
victory_core::logging::init_stderr_only(crates/victory-core/src/logging.rs) so helper children log to stderr without opening or truncatingVICTORY_LOG_FILE.crates/victory-hle/src/modules/audio/capture.rs(recorder_commandstripsVICTORY_LOG_FILEfrom the child environment; addedcapture::is_child()) andapps/victory/src/main.rs(checkscapture::is_child()beforelogging::initand callsinit_stderr_only("info")for the recorder child).logging::tests::two_process_stderr_only_child_preserves_parent_log_fileincrates/victory-core/src/logging.rs(parent logsBEFORE, spawns child withinit_stderr_onlyloggingCHILD, logsAFTER; checks all three on stderr and exact intact 2-line parent log file with no NUL bytes).modules::audio::capture::tests::recorder_command_clears_log_file_envincrates/victory-hle/src/modules/audio/capture.rs.audio_capture_child_does_not_truncate_parent_log_fileinapps/victory/tests/logging.rs(#[cfg(all(windows, feature = "diagnostics"))]: spawns thevictorybinary withVICTORY_AUDIO_CAPTURE+VICTORY_AUDIO_CAPTURE_OF=0between parentBEFORE/AFTERlogs and verifies parent log integrity and child stderr output).Verification (
5aebbc4)rustfmt --edition 2024 --check crates/victory-core/src/logging.rs apps/victory/src/main.rs apps/victory/tests/logging.rs(passed)cargo xtask policy(asset policy: 183 files ok)cargo test -p victory-core -p victory -p xtask --locked(victory-core: 20 passed,victory: 10 + 2 passed,xtask: 6 passed)cargo test -p victory-core -p victory -p xtask --all-features --locked(victory-core: 20 passed,victory: 10 + 2 + 1loggingpassed,xtask: 6 passed)cargo test -p victory-hle --all-features --locked capture(1 passed)cargo clippy --workspace --all-targets --locked -- -D warnings&--all-features(both passed)AI-assisted (Antigravity); synthetic tests only, no game data.
@Marvisak on GitHub · 2026-11-25 13:30 UTC · original
Automated triage for the maintainers.
The PR adds
VICTORY_LOG_FILE(a plain-text copy of the log) and colour on stderr only when it is a terminal (crates/victory-core/src/logging.rs). It also keeps the audio recorder child from opening the file:capture.rsrecorder_commandstrips the variable, andmain.rscallsinit_stderr_onlyfor the child. The follow-up commit answers the truncation report from a reviewer.This needs the maintainer's decision. It changes dependencies (
tracingadded tovictory-core/Cargo.toml, andCargo.lock), and it changes how the program spawns its helper process. Its tests also spawn processes (apps/victory/tests/logging.rs, the two-process test inlogging.rs). No CI run is recorded for this head, so build and test status here is unknown. Smaller point:logging.rsgrows by about 350 lines for a log-file option, so a leaner version would be easier to review.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.