January 2019
Intermediate to advanced
520 pages
14h 32m
English
Compile this example. To run it with an activated logger, you have to set the RUST_LOG environment variable. The env_logger crate reads it and configures the logger using filters from this variable. A logger instance must be configured with a corresponding logging level.
You can set RUST_LOG temporarily before the cargo run command:
RUST_LOG=trace cargo run
However, this will also print a lot of cargo tool and compiler records, because the Rust compiler also uses the log crate for logging. You can exclude all records except for those of your program using filtering by name. You only need to use part of the target name, as follows: ...
Read now
Unlock full access