-
Notifications
You must be signed in to change notification settings - Fork 734
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
Expose fmt::format::Writer::new() #2512
Comments
goodspark
added a commit
to goodspark/rust-tracing
that referenced
this issue
Mar 21, 2023
Solves tokio-rs#2512 I'm writing a custom formatting layer and want to use UtcTime and format_time to format the time into a string.
Also related: #2223 |
This was referenced Aug 10, 2023
hawkw
added a commit
that referenced
this issue
Oct 12, 2023
## Motivation As seen here #2512 and #2223. Previously pr'ed here #2525, but no progress has been made there for quite some. I have applied the suggested changes. Not sure the formatting of the doc is sufficient or otherwise correct ## Solution Make the `format::Writer::new()` function public. I don't see any obvious trade-offs, but I am not familiar with the larger direction of tracing/subscriber, so I may be wrong. Closes #2512 Closes #2223 Co-authored-by: Cephas Storm <[email protected]> Co-authored-by: Eliza Weisman <[email protected]>
davidbarsky
pushed a commit
that referenced
this issue
Oct 12, 2023
## Motivation As seen here #2512 and #2223. Previously pr'ed here #2525, but no progress has been made there for quite some. I have applied the suggested changes. Not sure the formatting of the doc is sufficient or otherwise correct ## Solution Make the `format::Writer::new()` function public. I don't see any obvious trade-offs, but I am not familiar with the larger direction of tracing/subscriber, so I may be wrong. Closes #2512 Closes #2223 Co-authored-by: Cephas Storm <[email protected]> Co-authored-by: Eliza Weisman <[email protected]>
kaffarell
pushed a commit
to kaffarell/tracing
that referenced
this issue
Nov 21, 2023
## Motivation As seen here tokio-rs#2512 and tokio-rs#2223. Previously pr'ed here tokio-rs#2525, but no progress has been made there for quite some. I have applied the suggested changes. Not sure the formatting of the doc is sufficient or otherwise correct ## Solution Make the `format::Writer::new()` function public. I don't see any obvious trade-offs, but I am not familiar with the larger direction of tracing/subscriber, so I may be wrong. Closes tokio-rs#2512 Closes tokio-rs#2223 Co-authored-by: Cephas Storm <[email protected]> Co-authored-by: Eliza Weisman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
Make the constructer of Writer from tracing_subscriber available outside of the crate. I'm not sure I should file this issue in a different repo since tracing_subscriber is in it's own repo.
Crates
tracing-subscriber
Motivation
I have a server that needs to be logged remotely. What I am trying to do is add a Layer that copies the formatted output from fmt and sends it down a tokio channel (and subsequently a grpc stream), but I can't just use with_writer since I also want to attach the log level and other context data. I managed to implement my own Layer based upon the example:
and that allowed me get access to this data, but I'd rather not try to reimplement (and at present have no idea how one would implement) tracing-subscriber's fmt stuff. After digging through the source code some more, I found the formatter layer that seems to have mosts things already configured for me:
(this is ripped directly from the documentation in the source code)
However, I now need to access the data in the writer, which is not possible. I initially thought I could just ignore the parameter and create my own writer, but the
Writer::new(...)
is private. I did there was a comment to(I believe) @hawkw about making this public and making the necessary considerations.I am very new to tracing (and tokio for that matter) so I'm not sure this is the best way to accomplish my outlined goals.
Proposal
Remove the pub(crate) and just make it pub.
There comments about considerating creating an explicit from_string() constructor or some such.
Alternatives
I have no idea
The text was updated successfully, but these errors were encountered: