add some debug messages

This commit is contained in:
Armaël Guéneau 2024-04-09 21:14:25 +02:00
parent f1cb4a9982
commit 6643c471a0

View file

@ -13,7 +13,7 @@ const RESTIC_ALARM_WATCH_DIR: &str = "watch/";
const S3_REGION: &str = "infracoll";
const S3_ENDPOINT: &str = "http://garage.isomorphis.me:3900";
#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
struct State {
last_alert: HashMap<String, u64>,
}
@ -224,13 +224,21 @@ async fn main() -> eyre::Result<()> {
let client = aws_sdk_s3::Client::from_conf(config);
let repos = to_watch(&client).await?;
println!("Watching repos:");
for r in repos.iter() {
println!("{}", r);
}
let mut state = read_state(&client).await?;
println!("Current state: {:?}", &state);
for repo in repos {
match check_repo(&client, &mut state, &repo).await {
Ok(()) => (),
Ok(()) => {
println!("{}: OK", &repo);
},
Err(err) => {
// is this the best way to log the error?
eprintln!("Error: {:?}", err)
println!("Error ({}): {:?}", &repo, err)
}
}
}