Add FW Version in journalctl log

Adds version logging for AFM and CPLD active and recovery versions as well
as BMC and BIOS recovery versions on every AC cycle and BMC reboot.
Log format: VERSION INFO - <ITEM>_<RECOVERY/ACTIVE> - <version info>
Where <ITEM> is "afm" "bmc", "bios", or "cpld"
and <RECOVERY/ACTIVE> will specify "recovery" or "active" depending on
if the version is the recovery version or the active version,
respectively.
If any version is empty, e.g. "0.0", then it is not printed.
User can retrieve FW versions by running:
journalctl | grep "VERSION INFO"

Tested:
AC Cycle:
VERSION INFO - cpld_active - xx.x-x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx
VERSION INFO - bmc_recovery - x.xx-xx-xxxxxxx
VERSION INFO - bios_recovery - x.x
VERSION INFO - cpld_recovery - x.x
VERSION INFO - afm_active - x.x
VERSION INFO - afm_recovery - x.x

BMC reboot:
VERSION INFO - cpld_active - xx.x-x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx
VERSION INFO - bmc_recovery - x.xx-xx-xxxxxxx
VERSION INFO - bios_recovery - xxx.xxx
VERSION INFO - cpld_recovery - x.x
VERSION INFO - afm_active - x.x
VERSION INFO - afm_recovery - x.x

Change-Id: I955bc67a9cdc6d53a422d70ee999781cb6e22b08
Signed-off-by: Alex Schendel <alex.schendel@intel.com>
diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index 5560d5f..0a986f5 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -556,6 +556,7 @@
 static void updateCPLDversion(std::shared_ptr<sdbusplus::asio::connection> conn)
 {
     std::string cpldVersion = pfr::readCPLDVersion();
+    lg2::info("VERSION INFO - cpld_active - {VER}", "VER", cpldVersion);
     conn->async_method_call(
         [](const boost::system::error_code ec) {
             if (ec)
diff --git a/service/src/pfr_mgr.cpp b/service/src/pfr_mgr.cpp
index e2fdbfd..2fc73fd 100644
--- a/service/src/pfr_mgr.cpp
+++ b/service/src/pfr_mgr.cpp
@@ -19,6 +19,10 @@
 namespace pfr
 {
 
+inline void printVersion(const std::string& path, const std::string& version)
+{
+    lg2::info("VERSION INFO - {TYPE} - {VER}", "TYPE", path, "VER", version);
+}
 static constexpr uint8_t activeImage = 0;
 static constexpr uint8_t recoveryImage = 1;
 
@@ -34,6 +38,11 @@
 {
     version = getFirmwareVersion(imgType);
 
+    if (!(version == "0.0" || version.empty()))
+    {
+        printVersion(path, version);
+    }
+
     std::string objPath = "/xyz/openbmc_project/software/" + path;
     versionIface =
         server.add_interface(objPath, "xyz.openbmc_project.Software.Version");
@@ -112,6 +121,7 @@
     if (versionIface && versionIface->is_initialized())
     {
         std::string ver = getFirmwareVersion(imgType);
+        printVersion(path, ver);
         internalSet = true;
         versionIface->set_property(versionStr, ver);
         internalSet = false;