1 use anyhow
::{bail, Error}
;
6 pub async
fn display_task_log(
10 ) -> Result
<(), Error
> {
12 let path
= format
!("api2/json/nodes/localhost/tasks/{}/log", upid_str
);
18 let param
= json
!({ "start": start, "limit": limit, "test-status": true }
);
19 let result
= client
.get(&path
, Some(param
)).await?
;
21 let active
= result
["active"].as_bool().unwrap();
22 let total
= result
["total"].as_u64().unwrap();
23 let data
= result
["data"].as_array().unwrap();
25 let lines
= data
.len();
28 let n
= item
["n"].as_u64().unwrap();
29 let t
= item
["t"].as_str().unwrap();
30 if n
!= start { bail!("got wrong line number in response data ({}
!= {}
", n, start); }
31 if strip_date && t.len() > 27 && &t[25..27] == ": " {
42 std::thread::sleep(std::time::Duration::from_millis(1000));
47 if lines != limit { bail!("got wrong number of lines from server ({} != {})", lines
, limit
); }