Skip to content

demultiplexer pattern? #1961

Answered by davidbarsky
cong-or asked this question in Q&A
Feb 26, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

is it possible to collect logs and distribute the data to different sinks? For example, pipe data to stdout , text file and custom endpoint?

Yes. I'd look at this example: https://github.com/tokio-rs/tracing/blob/v0.1.x/examples/examples/fmt-multiple-writers.rs.

** in regards to custom endpoint, is it possible to write custom logic to send over the wire etc? **

Yes. The common approach is to implement your own Layer. The layers in tracing-subscriber are somewhat complex to learn from, but the formatting logic inside of https://github.com/davidbarsky/tracing-tree aside, it could be a good starting point to understand what a simpler layer can look like.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cong-or
Comment options

Answer selected by cong-or
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