util: Logging error on getService optional

Make logging an error on service name lookup for a given path/interface
optional for the case where a service may not be available yet. This is
to handle the case where a service dependent on a property from another
may be started in parallel by systemd where the property would need to
be retrieved by other means (i.e. interfacesAdded signal).

Tested:
    No change to current users of getService util function
    No error logged when service not found

Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: Ib570b83fe2feae07031fa477f468327a7b0554b0
diff --git a/utility.cpp b/utility.cpp
index 75ecb80..a55ffe8 100644
--- a/utility.cpp
+++ b/utility.cpp
@@ -34,7 +34,7 @@
 using json = nlohmann::json;
 
 std::string getService(const std::string& path, const std::string& interface,
-                       sdbusplus::bus::bus& bus)
+                       sdbusplus::bus::bus& bus, bool logError)
 {
     auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
                                       MAPPER_INTERFACE, "GetObject");
@@ -49,9 +49,12 @@
 
     if (response.empty())
     {
-        log<level::ERR>("Error in mapper response for getting service name",
-                        entry("PATH=%s", path.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
+        if (logError)
+        {
+            log<level::ERR>("Error in mapper response for getting service name",
+                            entry("PATH=%s", path.c_str()),
+                            entry("INTERFACE=%s", interface.c_str()));
+        }
         return std::string{};
     }