Open franciscoaguirre opened 4 weeks ago
We have tons of tests with logging. However, I don't see the reason for this issue. If someone is debugging a test, they can just add a logger. There is no need to have a logger in every test, because not every test will always fail.
Also not sure how many people are "debugging these tests" constantly that we need an issue for this.
And also don't use env_logger
, we have already sp_tracing::init_for_tests()
.
Logs are very helpful for xcm debugging in particular, where we mark them all with
target: xcm
and get them by specifyingRUST_LOG=xcm
. However, this doesn't work out-of-the-box with unit tests, since we need a logger. We can useenv_logger
but then each test needs this line in the start:let _ = env_logger::init();
. The other option is to addtest-log
as a dependency and import thetest
macro from it. This was already done inpolkadot/xcm/docs/src/cookbook/relay_token_transactor/tests.rs
.We could either adopt this everywhere or create a README of how to enable logs to make people's lives easier when debugging.