-
Notifications
You must be signed in to change notification settings - Fork 756
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
[wip] draft API for passing timer into formatters #2132
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
// XXX(eliza): could make this a generic param as a breaking change... | ||
timer: Option<Box<dyn time::FormatTime + Send + Sync>>, |
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.
mentioned this previously, but we can add a new generic parameter so long that we provide a default for the generic. I'm guessing some form of UTC time is probably best.
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This is a pretty helpful change, thanks. Upon working more with (I suppose this impacts the |
unfortunately, with the way that struct currently works, this is a bit annoying because the i think we might want to redesign this part of the formatter system so that a config struct can be passed in to formatters from other crates, instead, but that seems like a separate change... |
This is a rough draft of an API for passing timestamps into any formatter, rather than just ones that use
fmt::Format
. I haven't done all of the plumbing for this change yet, just sketched out the APIs.It's not clear if we can do this without a breaking change, unfortunately, since the
with_timer
method changes a type parameter offmt::Format
. We would want to changewith_timer
to not require that the event formatter befmt::Format
...but if we did that, we would no longer be able to change its type parameter.One non-breaking option is to leave that system in place but deprecate it in favor of a new API that works with any event formatter, but then we would have to come up with a better name...