dbus-sdr: Log error only after all paths failed

getManagedObjects is now checking multiple paths and log errors whenever
it fails with a path. However, for instance,
xyz.openbmc_project.ExternalSensor only supports
/xyz/openbmc_project/sensors (and not supports /xyz/openbmc_project/vr).
We should only log error when getManagedObjects fail for all paths.

Also, log the service name when failing.

Tested: with the change, there is no getManagedObjects errors in our
system.

Change-Id: Icafeae61a640ccc3e196e5ade8de2676994aae04
Signed-off-by: Tom Tung <shes050117@gmail.com>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index d47114b..e48cd91 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -328,10 +328,6 @@
                 ctx, sensorConnection.c_str(), paths[i], managedObjects);
             if (ec)
             {
-                phosphor::logging::log<phosphor::logging::level::ERR>(
-                    "GetMangagedObjects for getSensorMap failed",
-                    phosphor::logging::entry("ERROR=%s", ec.message().c_str()));
-
                 continue;
             }
             allManagedObjects.merge(managedObjects);
@@ -340,6 +336,11 @@
 
         if (!found)
         {
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "GetMangagedObjects for getSensorMap failed",
+                phosphor::logging::entry("SERVICE=%s",
+                                         sensorConnection.c_str()));
+
             return false;
         }