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
Refactor the logging component to a tracing component. #154
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.
I commented on a few things. I'm not sure what @tarcieri thinks is best for abscissa
in particular, so none of my feedback should be considered blocking :)
core/src/trace/component.rs
Outdated
|
||
// Construct a tracing subscriber with the supplied filter and enable reloading. | ||
let builder = FmtSubscriber::builder() | ||
// XXX this should use ColorChoice::should_ansi, but where |
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.
Looking at the log
code that was removed in this PR, it looks like ansi colors were always used (but I may be misreading it?)
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.
A lot of the color support regressed when I switched from term
to termcolor
(#47). I posted some up-to-date thoughts on it in this comment:
/// Attempt to log | ||
pub fn try_log(&self, record: &Record<'_>) -> Result<(), Error> { | ||
let mut stream = self.level_stream(record); | ||
let now = chrono::Utc::now(); |
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.
It looks like the removed logging code always used UTC timestamps. Should we configure tracing
's timestamps to also use UTC?
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.
I'm fine with using the system timezone (which for all of my servers is UTC) if that's the default.
There's an Also as of #148 the
It wasn't respected before, but I think it'd be a good idea. I've had people try to use it who were confused when it didn't work. |
If the tracing component uses |
It'd be better if the |
I'm not sure which of the discussions above are "resolved", but I think that the remaining things are: 1) correct use of |
I know how to construct a filter based on RUST_LOG using |
@hdevalence yup, sounds good! |
Re: |
Okay, this is blocking ZcashFoundation/zebra#108 so I would prefer to fix up the RUST_LOG stuff later if that's OK. |
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.
@hdevalence if you're done it looks good to me
Yep! |
Will resolve #149 when complete.
Some questions:
RUST_LOG
?I didn't update the crate list in the README.