is there a way to enable trace logging while runni...
# development
f
is there a way to enable trace logging while running a Rust test?
1
a
It’s very frustrating 😞
There are no setup-like functions in rust tests
So you need to explicitly register a logger in the first line of the test, and then you’ll get output
Could probably write a proc_macro to do it, actually…
simple_logger is probably the easiest: https://github.com/borntyping/rust-simple_logger
f
will do the explicit logger setup then for now
a
https://lib.rs/crates/test-env-log << apparently the proc macro exists 🙂
f
cool, will look into that too. although hopefully they have a variant that allows
#[tokio::test]
to work as well
but just got simple_logger up and works fine
w
there are a few examples around
f
thanks!
w
of using env_logger, which works reasonably well
(so, yea: what Daniel said… but there is some prior art)
f
👍
w
the advantage of env_logger is that you can leave it in place
and it will only actually log if you set
RUST_LOG=$etc
but yea, proc-macro-ing env_logger everywhere might work