Skip to content

where does RollingFileAppender implement MakeWriterExt? #1844

Answered by davidbarsky
keepsimple1 asked this question in Q&A
Discussion options

You must be logged in to vote

From the above example code, RollingFileAppender implements MakeWriterExt trait and can use and. Does that mean any type that implement std::io::Write also implements MakeWriterExt when using tracing-subscriber?

Not quite. MakeWriter is implemented on anything that implements std::io::Write and is wrapped by a std::sync::Arc or std::sync::Mutex. The documentation on MakeWriter notes:

This trait is already implemented for function pointers and immutably-borrowing closures that return an instance of io::Write, such as io::stdout and io::stderr. Additionally, it is implemented for std::sync::Mutex when the type inside the mutex implements io::Write.

Transitively, MakeWriterExt is impleme…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hawkw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants