Function ddshow_sink::enable_timely_logging[][src]

pub fn enable_timely_logging<A, W>(
    worker: &mut Worker<A>,
    writer: W
) -> Option<Box<dyn Any + 'static>> where
    A: Allocate,
    W: Write + 'static, 
Expand description

Writes all timely event logs to the given writer

See TimelyEvent for the events logged

Examples

use std::{env, net::TcpStream};

timely::execute_directly(|worker| {
    // If `TIMELY_WORKER_LOG_ADDR` is set, `ddshow_sink` will
    // send all events to the address that it's set with
    if let Ok(addr) = env::var("TIMELY_WORKER_LOG_ADDR") {
        if let Ok(stream) = TcpStream::connect(&addr) {
            ddshow_sink::enable_timely_logging(worker, stream);
        }
    }
     
    worker.dataflow::<(),_,_>(|scope| {
        (0..10).to_stream(scope)
            .inspect(|x| println!("seen: {:?}", x));
    });
});