Trait enso_flexer::prelude::logger::processor::Processor[][src]

pub trait Processor<Input> {
    type Output;
    fn submit(&mut self, input: Input) -> Self::Output;
}
Expand description

The most primitive building block of a logger. Processor takes some input and returns some output, forming a message processing pipeline.

Processors can be chained together with the use of the Seq processor. They can perform both simple actions like formatting the logs or outputting them to console, as well as more complex ones, like buffering them globally and dumping them on demand only. There are a lot of sample processors defined in this module and its sub-modules.

Processors always implement the Default trait, so it’s sufficient to construct them using type-level mechanisms only. For example, one of the simplest usages of processors would be a processor defined as Seq<Formatter<formatter::JsConsole>,Consumer<consumer::JsConsole>>, which for each input message first formats it and then prints it to the JavaScript console.

Associated Types

Loading content...

Required methods

fn submit(&mut self, input: Input) -> Self::Output[src]

Loading content...

Implementors

impl<C, Levels, Message> Processor<(Entry<Levels>, Option<Message>)> for Consumer<C> where
    C: Definition<Levels, Message>, 
[src]

type Output = ()

pub fn submit(
    &mut self,
    (Entry<Levels>, Option<Message>)
) -> <Consumer<C> as Processor<(Entry<Levels>, Option<Message>)>>::Output
[src]

impl<Fmt, Lvl> Processor<Entry<Lvl>> for Formatter<Fmt> where
    Fmt: GenericDefinition<Lvl>, 
[src]

type Output = (Entry<Lvl>, Option<<Fmt as Output>::Output>)

pub fn submit(
    &mut self,
    entry: Entry<Lvl>
) -> <Formatter<Fmt> as Processor<Entry<Lvl>>>::Output
[src]

impl<Input> Processor<Input> for Drop[src]

type Output = ()

pub fn submit(&mut self, _input: Input)[src]

impl<Input> Processor<Input> for Identity[src]

type Output = Input

pub fn submit(&mut self, input: Input) -> <Identity as Processor<Input>>::Output[src]

impl<Input, First, Second> Processor<Input> for BranchBuilder<First, Second> where
    Input: Clone,
    First: Processor<Input>,
    Second: Processor<Input>, 
[src]

type Output = ()

pub fn submit(
    &mut self,
    input: Input
) -> <BranchBuilder<First, Second> as Processor<Input>>::Output
[src]

impl<Input, First, Second> Processor<Input> for SeqBuilder<First, Second> where
    First: Processor<Input>,
    Second: Processor<<First as Processor<Input>>::Output>, 
[src]

type Output = <Second as Processor<<First as Processor<Input>>::Output>>::Output

pub fn submit(
    &mut self,
    input: Input
) -> <SeqBuilder<First, Second> as Processor<Input>>::Output
[src]

impl<Input, Next> Processor<Input> for Buffer<Input, Next> where
    Next: Processor<Input>, 
[src]

type Output = ()

pub fn submit(&mut self, input: Input)[src]

impl<P, Input> Processor<Input> for Global<P> where
    P: GlobalProcessor,
    <P as GlobalProcessor>::Processor: 'static,
    <P as GlobalProcessor>::Processor: Processor<Input>, 
[src]

type Output = <<P as GlobalProcessor>::Processor as Processor<Input>>::Output

pub fn submit(
    &mut self,
    entry: Input
) -> <Global<P> as Processor<Input>>::Output
[src]

Loading content...