meson: use phosphor-logging for debug statements

There is no need to individually patch each file to enable debug
logging.

All the different definitions of 'bool debug' are removed in favor of
using phosphor-logging.

Change-Id: Ia9a8ecfa4ea220f588d7cf2d291b14067e0391e7
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/fru_utils.cpp b/src/fru_utils.cpp
index 15d4234..f39bbac 100644
--- a/src/fru_utils.cpp
+++ b/src/fru_utils.cpp
@@ -17,6 +17,8 @@
 
 #include "fru_utils.hpp"
 
+#include <phosphor-logging/lg2.hpp>
+
 #include <array>
 #include <cstddef>
 #include <cstdint>
@@ -35,7 +37,6 @@
 #include <linux/i2c.h>
 }
 
-static constexpr bool debug = false;
 constexpr size_t fruVersion = 1; // Current FRU spec version number is 1
 
 std::tm intelEpoch()
@@ -646,23 +647,18 @@
     // ipmi spec format version number is currently at 1, verify it
     if (blockData[0] != fruVersion)
     {
-        if (debug)
-        {
-            std::cerr << "FRU spec version " << (int)(blockData[0])
-                      << " not supported. Supported version is "
-                      << (int)(fruVersion) << "\n";
-        }
+        lg2::debug(
+            "FRU spec version {VERSION} not supported. Supported version is {SUPPORTED_VERSION}",
+            "VERSION", lg2::hex, blockData[0], "SUPPORTED_VERSION", lg2::hex,
+            fruVersion);
         return false;
     }
 
     // verify pad is set to 0
     if (blockData[6] != 0x0)
     {
-        if (debug)
-        {
-            std::cerr << "PAD value in header is non zero, value is "
-                      << (int)(blockData[6]) << "\n";
-        }
+        lg2::debug("Pad value in header is non zero, value is {VALUE}", "VALUE",
+                   lg2::hex, blockData[6]);
         return false;
     }
 
@@ -691,12 +687,10 @@
 
     if (sum != blockData[7])
     {
-        if (debug)
-        {
-            std::cerr << "Checksum " << (int)(blockData[7])
-                      << " is invalid. calculated checksum is " << (int)(sum)
-                      << "\n";
-        }
+        lg2::debug(
+            "Checksum {CHECKSUM} is invalid. calculated checksum is {CALCULATED_CHECKSUM}",
+            "CHECKSUM", lg2::hex, blockData[7], "CALCULATED_CHECKSUM", lg2::hex,
+            sum);
         return false;
     }
     return true;
@@ -737,11 +731,8 @@
         return findFRUHeader(reader, errorHelp, blockData, baseOffset);
     }
 
-    if (debug)
-    {
-        std::cerr << "Illegal header " << errorHelp << " base offset "
-                  << baseOffset << "\n";
-    }
+    lg2::debug("Illegal header {HEADER} base offset {OFFSET}", "HEADER",
+               errorHelp, "OFFSET", baseOffset);
 
     return false;
 }