[pve-devel] [PATCH v3 proxmox 22/66] notify: additional logging when sending a notification
Lukas Wagner
l.wagner at proxmox.com
Mon Jul 17 17:00:07 CEST 2023
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
proxmox-notify/src/lib.rs | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs
index 3c2b6d55..d2f15496 100644
--- a/proxmox-notify/src/lib.rs
+++ b/proxmox-notify/src/lib.rs
@@ -317,9 +317,12 @@ impl Bus {
if let Some(group) = self.groups.get(endpoint_or_group) {
if !Bus::check_filter(&mut filter_matcher, group.filter.as_deref()) {
+ log::info!("skipped target '{endpoint_or_group}', filter did not match");
return;
}
+ log::info!("target '{endpoint_or_group}' is a group, notifying all members...");
+
for endpoint in &group.endpoint {
self.send_via_single_endpoint(endpoint, notification, &mut filter_matcher);
}
@@ -351,19 +354,23 @@ impl Bus {
filter_matcher: &mut FilterMatcher,
) {
if let Some(endpoint) = self.endpoints.get(endpoint) {
+ let name = endpoint.name();
if !Bus::check_filter(filter_matcher, endpoint.filter()) {
+ log::info!("skipped target '{name}', filter did not match");
return;
}
- if let Err(e) = endpoint.send(notification) {
- // Only log on errors, do not propagate fail to the caller.
- log::error!(
- "could not notify via target `{name}`: {e}",
- name = endpoint.name()
- );
+ match endpoint.send(notification) {
+ Ok(_) => {
+ log::info!("notified via target `{name}`");
+ }
+ Err(e) => {
+ // Only log on errors, do not propagate fail to the caller.
+ log::error!("could not notify via target `{name}`: {e}");
+ }
}
} else {
- log::error!("could not notify via endpoint '{endpoint}', it does not exist");
+ log::error!("could not notify via target '{endpoint}', it does not exist");
}
}
--
2.39.2
More information about the pve-devel
mailing list