pub trait Processor: 'static + Sized {
    fn process(&self, tree: Tree);

    fn into_layer(self) -> TreeLayer<Self> { ... }
}
Expand description

A type that can process trace trees.

Processors are responsible for both formatting and writing logs to their intended destinations. This is typically implemented using Formatter, tracing_subscriber::fmt::MakeWriter, and std::io::Write.

This trait is already implemented for BlockingProcessor and AsyncProcessor.

Required methods

Processes the Tree of logs. Implementors of this trait are free to define what this means, such as:

  • Writing to a stdout or a file
  • Sending over a network
  • Storing in memory for later access
  • Ignoring
  • Or anything else!

Provided methods

Converts the Processor into a TreeLayer.

This is the same as TreeLayer::new(processor).

Examples
let layer = BlockingProcessor::new(Pretty::new(), std::io::stdout).into_layer();

Implementors