Logging Rust programs
When executing your program, you need to set the RUST_LOG
environment variable appropriately; it is (as far as this is concerned) a comma-separated key=value list; the keys are crate or module names, e.g. extra
or std::option
; the values are numbers, mapped to log levels:
- 1: error
- 2: warn
- 3: info
- 4: debug
(Each level includes the more significant levels.)
In Command Prompt, compiling and running myprog
with showing warnings and errors would be something like:
rustc myprog.rs
set RUST_LOG=myprog=4
myprog.exe