use clx::progress::{ProgressJobBuilder, ProgressStatus, init_log_integration};
use log::{debug, error, info, warn};
use std::{thread, time::Duration};
fn main() {
init_log_integration();
info!("Starting application");
let job = ProgressJobBuilder::new()
.body("{{ spinner() }} {{ message }} [{{ cur }}/{{ total }}]")
.prop("message", "Processing items")
.progress_total(10)
.start();
for i in 0..10 {
thread::sleep(Duration::from_millis(200));
job.progress_current(i + 1);
match i {
2 => debug!("Debug: processed item {}", i + 1),
4 => info!("Info: halfway there!"),
6 => warn!("Warning: item {} took longer than expected", i + 1),
8 => error!("Error: simulated error at item {}", i + 1),
_ => {}
}
}
job.set_status(ProgressStatus::Done);
info!("Application complete");
}