This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Fix logging from inside the WASM runtime#7355
Merged
Conversation
When using `RuntimeLogger` to log something from the runtime, we didn't set any logging level. So, we actually did not log anything from the runtime as logging is disabled by default. This pr fixes that by setting the logging level to `TRACE`. It also adds a test to ensure this does not break again ;)
tomusdrw
reviewed
Oct 19, 2020
frame/support/src/debug.rs
Outdated
| } | ||
|
|
||
| fn log(&self, record: &log::Record) { | ||
| debug(&"Hey2"); |
Contributor
There was a problem hiding this comment.
I suppose this is not intended.
| // | ||
| // If we don't set any level, logging is disabled | ||
| // completly. | ||
| log::set_max_level(log::LevelFilter::Trace); |
Contributor
There was a problem hiding this comment.
AFAIR it shouldn't matter. We already return true in log::Log::enabled which should be responsible for filtering like that? Are you sure it's actually filtered somewhere internally in log crate?
Member
Author
There was a problem hiding this comment.
Yes. I checked that. Remove the line and the test fails ;)
Member
Author
There was a problem hiding this comment.
https://docs.rs/log/0.4.11/log/#implementing-a-logger
They also mention it here that you need to call it.
Member
Author
There was a problem hiding this comment.
https://docs.rs/log/0.4.11/src/log/macros.rs.html#46
Here they call the max_level function that checks the value that is set with set_max_value
bkchr
commented
Oct 19, 2020
tomusdrw
approved these changes
Oct 20, 2020
| // | ||
| // If we don't set any level, logging is disabled | ||
| // completly. | ||
| log::set_max_level(log::LevelFilter::Trace); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
RuntimeLoggerto log something from the runtime, we didn'tset any logging level. So, we actually did not log anything from the
runtime as logging is disabled by default. This pr fixes that by setting
the logging level to
TRACE. It also adds a test to ensure this doesnot break again ;)