[pve-devel] [PATCH v4 proxmox 24/69] notify: additional logging when sending a notification

Lukas Wagner l.wagner at proxmox.com
Thu Jul 20 16:31:51 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 0059e44b..6a52db06 100644
--- a/proxmox-notify/src/lib.rs
+++ b/proxmox-notify/src/lib.rs
@@ -305,9 +305,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);
             }
@@ -339,19 +342,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