there's a way to make rust logging appear in the o...
# development
h
there's a way to make rust logging appear in the output of a failing pants test, right?
f
when I’ve needed rust logs in tests, I’ve had to add
env_logger
to the crate’s dependencies and then add
env_logger::init()
at the top of the test
and then invoke with
RUST_LOG=trace cargo test — name_of_test
(or whatever level you want)
given rust does not support test setup functions, not that easy to enable logging 😞
h
turns out its easier to add printfs, which do manifest themselves in the output
that is, the
Captured stdout call
output in pytest
but I think setting
RUST_LOG
might've been what I was looking for
f
be aware that
RUST_LOG
is from the env_logger crate
thus you would still have to setup env_logger
w
TestBase doesn’t initialize our rust logging
it probably could.