Struct slog_term::TestStdoutWriter[][src]

pub struct TestStdoutWriter;

Replacement for std::io::stdout() for when output capturing by rust's test harness is required.

Note

Due to the way that output capturing works in Rust, using this class has no effect if the logger is later passed to another thread that is not controlled by Rust's testing framework. See rust-lang/rust#42474 for reference.

For this reason, combining this drain with Async, for example, has no effect.

Example

#[test]
fn test_logger() {
    let logger = {
        let decorator = slog_term::PlainSyncDecorator::new(slog_term::TestStdoutWriter);
        let drain = slog_term::FullFormat::new(decorator).build().fuse();

        Logger::root_typed(drain, o!())
    };
    info!(logger, "Hi from logger test");
}

Trait Implementations

impl Write for TestStdoutWriter[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.