#progress-bar #progress #logging #log #log-line

indicatif-log-bridge

Bridge the log crate and indicatif to stop log lines from mixing up with progress bars

4 releases

0.2.2 Aug 31, 2023
0.2.1 Jul 31, 2023
0.2.0 Jul 31, 2023
0.1.0 Jul 31, 2023

#90 in Concurrency

Download history 11726/week @ 2024-01-05 15078/week @ 2024-01-12 11759/week @ 2024-01-19 8835/week @ 2024-01-26 10244/week @ 2024-02-02 9017/week @ 2024-02-09 8694/week @ 2024-02-16 8335/week @ 2024-02-23 8908/week @ 2024-03-01 5778/week @ 2024-03-08 6002/week @ 2024-03-15 5618/week @ 2024-03-22 6094/week @ 2024-03-29 9836/week @ 2024-04-05 7364/week @ 2024-04-12 4973/week @ 2024-04-19

29,173 downloads per month
Used in 19 crates (14 directly)

MIT license

7KB

Indicatif Log Bridge

Tired of your log lines and progress bars mixing up? indicatif_log_bridge to the rescue!

Simply wrap your favourite logging implementation in LogWrapper and those worries are a thing of the past.

Just remember to only use progress bars added to the MultiProgress you used , otherwise you are back to ghostly halves of progress bars everywhere.

Example

    let logger =
        env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"))
            .build();
    let multi = MultiProgress::new();

    LogWrapper::new(multi.clone(), logger)
        .try_init()
        .unwrap();

    let pg = multi.add(ProgressBar::new(10));
    for i in (0..10) {
        std::thread::sleep(Duration::from_micros(100));
        info!("iteration {}", i);
        pg.inc(1);
    }
    pg.finish();
    multi.remove(&pg);

The code of this crate is pretty simple, so feel free to check it out.

Dependencies

~1.3–9MB
~67K SLoC