[][src]Struct fern::Panic

pub struct Panic;

Logger which will panic whenever anything is logged. The panic will be exactly the message of the log.

Panic is useful primarily as a secondary logger, filtered by warning or error.

Examples

This configuration will output all messages to stdout and panic if an Error message is sent.

fern::Dispatch::new()
    // format, etc.
    .chain(std::io::stdout())
    .chain(
        fern::Dispatch::new()
            .level(log::LevelFilter::Error)
            .chain(fern::Panic)
    )
    .apply()?;

This sets up a "panic on warn+" logger, and ignores errors so it can be called multiple times.

This might be useful in test setup, for example, to disallow warn-level messages.

fn setup_panic_logging() {
    fern::Dispatch::new()
        .level(log::LevelFilter::Warn)
        .chain(fern::Panic)
        .apply()
        // ignore errors from setting up logging twice
        .ok();
}

Trait Implementations

impl From<Panic> for Output[src]

fn from(_: Panic) -> Self[src]

Creates an output logger which will panic with message text for all messages.

Auto Trait Implementations

impl Send for Panic

impl Sync for Panic

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.