use std::sync::Mutex;
static REPORTED: Mutex<Vec<(&'static str, bool)>> = Mutex::new(Vec::new());
pub fn note_route_engagement(
route: &'static str,
fallback: &'static str,
engaged: bool,
detail: &str,
) {
let first = match REPORTED.lock() {
Ok(mut reported) => {
if reported.contains(&(route, engaged)) {
false
} else {
reported.push((route, engaged));
true
}
}
Err(_) => true,
};
if !first {
return;
}
if engaged {
log::warn!("[{route}] device ENGAGED: {detail}");
} else {
log::warn!("[{route}] device DECLINED - {fallback}: {detail}");
}
}