I have the following problem: I compile and run Rust program whose code I don't know too well using cargo run
. It compiles fine, but somewhere in the code is a print/logging statement that prints way too many characters, causing the console to hang and Visual Studio code to crash. Due to the crash I can't read what is actually printed out which could help identifying the error.
Is there a way to print the output of cargo run
to a text file?
I execute the command in Powershell, but the Powershell commands I tried (Start-Transcription
and | Out-File -FilePath
...) do not capture what cargo is printing out.
cargo run > out.txt
or cargo run >> out.txt
also prints only a few lines that are printed to the console by println!
, but does not record the output of logging crates such as env_logger, which I would need.
Is there a way to achieve this? (My OS is Windows)