-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace env_logger with sp_tracing #4660
Comments
Have you tried using sp_tracing instead of env_logger? I've seen env_logger in subsystem-benchmarks omitting several logs for some reason |
This one works as expected, thank you. fn main() {
sp_tracing::init_for_tests();
let a: i32 = 7;
let hash = polkadot_primitives::Hash::repeat_byte(0xFA);
let candidate_hash = polkadot_primitives::CandidateHash(hash);
gum::info!(target: "bar", a, "xxx");
gum::info!(target: "bar", a, ?hash, "xxx");
gum::info!(target: "bar", a, ?hash, ?candidate_hash, "xxx");
}
But what about |
I agree it'd be good to replace env_logger with sp_tracing where possible. Not sure what's the root-cause of this bug (whether it's in gum or env_logger). |
gum
skips logs with CandidateHash
Updated issue, seems like a good first one |
I would like to take this on, I will start with doing the replacement in all test files, should it be replaced somewhere else? |
That's great! Let's start with tests but it would be great to understand where else we have it, maybe you can post a list here? |
very very dumb question, what is the process to make a pull request here? is it a fork then a pull request from the fork? asking because I do not have permission to add a new branch here. |
@Safrout1 Yes, you have to do it over your own fork |
@AndreiEres This is a draft pull request with one file only (for now), is this what we intend to do here, if yes, I will add all the other files: #5065 |
@AndreiEres I have updated the PR with all test files except for one: substrate/frame/contracts/src/tests.rs These files on the other hand are non-test files that use env_logger, let me know if those should be changed as well: |
This PR replaces env_logger with sp_tracing because of an issue with env_logger and gum #4660 --------- Co-authored-by: Adrian Catangiu <[email protected]> Co-authored-by: Andrei Eres <[email protected]>
Description of bug
env_logger
working withgum
seems to be skipping logs includesCandidateHash
Steps to reproduce
Minimal test case:
Output:
The third line with a candidate hash is absent.
What to do
We use
env_logger
only in tests, so it's better just to replace it withsp_tracing
.The text was updated successfully, but these errors were encountered: