I'm experiencing a very perplexing problem trying to enable debug logging with rust.
I have tried stripping down everything to just a basic example program, using the example here:
Basically I have made a project with the first example program verbatim, and have compiled, and used the RUST_LOG=debug ./target/debug/test_debug_log, or RUST_LOG=debug cargo run, but I only get the WARN and INFO log messages.
I have even gone as far as trying to set the log level inside the program directly:
fn main() {
env_logger::init();
log::set_max_level(LevelFilter::Debug);
if log_enabled!(Level::Debug) {
println!("LOG LEVEL DEBUG");
}
warn!("[root] warn");
info!("[root] info");
debug!("[root] debug");
foo::run();
}
And literally setting the max level via log, in the program, to debug, doesn't end up showing the print statement. If I switch the test to checking if 'Warn' or 'Info' is enabled, it will print the subsequent message.
Even setting max level to 'trace' or RUST_LOG=trace on the console doesn't seem to effect anything, and the only way I have been able to get the debug traces to show up has been to replace the debug! macro in my module with:
macro_rules! debug {
($($arg:tt)*) => (println!($($arg)*))
}
This seems so completely basic, that I'm sure I'm missing some obvious RTFM moment, but I have scoured over the documents, and it seems like this should work.