regulators: Add phase faults to ErrorLogging

Enhance the ErrorLogging class hierarchy to log phase fault errors.
Support specifying additional error data that may have been collected
from the device.

Tested:
* Logged an N phase fault error
* Logged an N+1 phase fault error
* Verified mock logPhaseFault() method could be used in a gtest.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I67efb7e16bb3fc5a071ccc60a949bba30daf3e78
diff --git a/phosphor-regulators/src/error_logging.cpp b/phosphor-regulators/src/error_logging.cpp
index bc3d388..9ebce1a 100644
--- a/phosphor-regulators/src/error_logging.cpp
+++ b/phosphor-regulators/src/error_logging.cpp
@@ -86,6 +86,19 @@
              additionalData, journal);
 }
 
+void DBusErrorLogging::logPhaseFault(
+    Entry::Level severity, Journal& journal, PhaseFaultType type,
+    const std::string& inventoryPath,
+    std::map<std::string, std::string> additionalData)
+{
+    std::string message =
+        (type == PhaseFaultType::n)
+            ? "xyz.openbmc_project.Power.Regulators.Error.PhaseFault.N"
+            : "xyz.openbmc_project.Power.Regulators.Error.PhaseFault.NPlus1";
+    additionalData.emplace("CALLOUT_INVENTORY_PATH", inventoryPath);
+    logError(message, severity, additionalData, journal);
+}
+
 void DBusErrorLogging::logPMBusError(Entry::Level severity, Journal& journal,
                                      const std::string& inventoryPath)
 {