entity-manager: fix throw in fwVersionIsSame

fwVersionIsSame may throw on failure to create a directory.
Change to using the non-throwing overload.

Also convert the function to use phosphor-logging while we are here.

Tested: Using the unit tests in [1]

References:
[1] https://gerrit.openbmc.org/c/openbmc/entity-manager/+/81489/21

Change-Id: Idc622299fb6538c4a60d10a135a60d7a16b124d6
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/utils.cpp b/src/entity_manager/utils.cpp
index 3e4a805..0f6f079 100644
--- a/src/entity_manager/utils.cpp
+++ b/src/entity_manager/utils.cpp
@@ -2,6 +2,7 @@
 
 #include "../variant_visitors.hpp"
 #include "expression.hpp"
+#include "phosphor-logging/lg2.hpp"
 
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/classification.hpp>
@@ -26,7 +27,7 @@
     std::ifstream version(versionFile);
     if (!version.good())
     {
-        std::cerr << "Can't read " << versionFile << "\n";
+        lg2::error("Can't read {PATH}", "PATH", versionFile);
         return false;
     }
 
@@ -40,7 +41,16 @@
     std::string expectedHash =
         std::to_string(std::hash<std::string>{}(versionData));
 
-    std::filesystem::create_directory(configurationOutDir);
+    std::error_code ec;
+    std::filesystem::create_directory(configurationOutDir, ec);
+
+    if (ec)
+    {
+        lg2::error("could not create directory {DIR}", "DIR",
+                   configurationOutDir);
+        return false;
+    }
+
     std::ifstream hashFile(versionHashFile);
     if (hashFile.good())
     {