Trait FormatEvent

Source
pub trait FormatEvent<N> {
    // Required method
    fn format_event(
        &self,
        ctx: &Context<'_, N>,
        writer: &mut dyn Write,
        event: &Event<'_>,
    ) -> Result<(), Error>;
}
Expand description

A type that can format a tracing Event for a fmt::Write.

FormatEvent is primarily used in the context of [FmtSubscriber]. Each time an event is dispatched to [FmtSubscriber], the subscriber forwards it to its associated FormatEvent to emit a log message.

This trait is already implemented for function pointers with the same signature as format.

Required Methods§

Source

fn format_event( &self, ctx: &Context<'_, N>, writer: &mut dyn Write, event: &Event<'_>, ) -> Result<(), Error>

Write a log message for Event in Context to the given Write.

Implementations on Foreign Types§

Source§

impl<N> FormatEvent<N> for fn(&Context<'_, N>, &mut dyn Write, &Event<'_>) -> Result<(), Error>

Source§

fn format_event( &self, ctx: &Context<'_, N>, writer: &mut dyn Write, event: &Event<'_>, ) -> Result<(), Error>

Implementors§

Source§

impl<N, T> FormatEvent<N> for Format<Compact, T>
where N: for<'a> NewVisitor<'a>, T: FormatTime,

Source§

impl<N, T> FormatEvent<N> for Format<Full, T>
where N: for<'a> NewVisitor<'a>, T: FormatTime,