messaging_thread_pool 5.0.3

A library for aiding the creation of typed thread pool of objects that is communicated with via channels
Documentation
use tracing::{Dispatch, metadata::LevelFilter};
use tracing_subscriber::FmtSubscriber;

/// A trace helper used in the examples
pub fn global_test_scope(filter: LevelFilter) {
    let subscriber = FmtSubscriber::builder()
        .with_thread_ids(true)
        .with_max_level(filter)
        // completes the builder.
        .finish();
    let dispatcher = Dispatch::new(subscriber);
    tracing::dispatcher::set_global_default(dispatcher).unwrap();
}

/// A trace helper used in the examples that scopes the trace to the provided closure
pub fn test_scope(filter: LevelFilter, enclosed_function: fn() -> ()) {
    let subscriber = FmtSubscriber::builder()
        // all spans/events with a level higher than LevelFilter
        // will be written to stdout.
        .with_max_level(filter)
        //.without_time()
        // completes the builder.
        .finish();

    let dispatcher = Dispatch::new(subscriber);

    tracing::dispatcher::with_default(&dispatcher, || {
        // Any trace events generated in this closure or by functions it calls
        // will be collected by `my_subscriber`.
        enclosed_function()
    });
}