I can’t get logging to work in a custom pallet when running unit tests:
RUST_LOG=runtime=debug cargo test --features rococo-local -- --nocapture
log::debug!("")
doesn’t work and println!()
doesn’t compile because of no-std
. (edited)
The custom pallet is importing the log
facade:
use frame_support::{
dispatch::{DispatchInfo, DispatchResult, PostDispatchInfo},
ensure, log,
pallet_prelude::*,
traits::IsSubType,
};
Cargo.toml
does not have a log crate but I tried adding log = "0.4.17"
to dependencies
and also dev-dependencies
but that had no effect. I did not try adding it to both.
I tried RUST_LOG=debug
, RUST_LOG=runtime=debug
and RUST_LOG=test=debug
to no avail.
IMPORTANT NOTE: The log is not in the unit tests. It’s in the custom pallet lib.rs
which is being called by the unit test.