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
Default to default logging sync=info #448
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect technically, however I'm not sure if it is a good idea to disable RUST_LOG
by default, in favor of defaulting sync=info
. Afaik, RUST_LOG=trace
works in parity along with informer (I can be wrong, but I'm pretty sure I used RUST_LOG
to enable secretstore traces). So maybe we could do the same someday. I'll approve, but will leave it for merge to someone else.
Just tested, sync=info overrides RUST_LOG=trace and the latter only works with -q. |
I've started parity with cl:
and with config:
So there's no
I maybe missing something, but looks like it works even without '-q' flag |
I'm talking about but introducing an |
@5chdn Hope you don't mind that I've added this change to your PR: now RUST_LOG works even without '-q' flag. So now pbtc behaves the same way as parity does |
Just noticed. Compiling. |
Switching to WIP. Will test it when I'm back at some place with real internet. |
Yes, works for me. I updated the README, this is good to go now. |
Cool, thanks :) |
@@ -46,7 +47,12 @@ impl LogFormatter for DateAndColorLogFormatter { | |||
|
|||
pub fn init<T>(filters: &str, formatter: T) where T: LogFormatter { | |||
let mut builder = LogBuilder::new(); | |||
builder.parse(filters); | |||
let filters = match env::var("RUST_LOG") { | |||
Ok(env_filters) => format!("{},{}", env_filters, filters), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to understand this, where does env_filters
come from in this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from environment variable RUST_LOG
. and in format!()
I just merge these two together, so that it would be either (RUST_LOG and sync=info) or (RUST_LOG), depending on -q
existance => RUST_LOG always works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super elegant. Thanks.
Incldues:
sync=info
.--quiet
flag to suppress that.Rationale:
sync=info
logging at some point. (Or to write a beautiful logger.)RUST_LOG
only works in combination with the-q
switch to suppress the default logging.