regulators: Add logDebug() to journal interface

Enhance the journal interface to support logging messages with a
priority value of 'DEBUG'.

DEBUG messages are not normally stored by the systemd journal.  However,
the systemd journal configuration can be modified to store and display
them when debugging a problem.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I93e43db79714a5b68fee2dd824d21b42f1aa6a45
diff --git a/phosphor-regulators/src/journal.cpp b/phosphor-regulators/src/journal.cpp
index 5139945..9a50e1e 100644
--- a/phosphor-regulators/src/journal.cpp
+++ b/phosphor-regulators/src/journal.cpp
@@ -39,4 +39,9 @@
     log<level::INFO>(message.c_str());
 }
 
+void logDebug(const std::string& message)
+{
+    log<level::DEBUG>(message.c_str());
+}
+
 } // namespace phosphor::power::regulators::journal
diff --git a/phosphor-regulators/src/journal.hpp b/phosphor-regulators/src/journal.hpp
index f053c66..f07ab1a 100644
--- a/phosphor-regulators/src/journal.hpp
+++ b/phosphor-regulators/src/journal.hpp
@@ -20,7 +20,7 @@
 /**
  * Systemd journal interface.
  *
- * Provides functions to log informational and error messages to the journal.
+ * Provides functions to log messages to the systemd journal.
  *
  * This interface provides an abstraction layer so that testcases can use a mock
  * implementation and validate the logged messages.
@@ -46,4 +46,11 @@
  */
 void logInfo(const std::string& message);
 
+/**
+ * Logs a message with a priority value of 'DEBUG' to the systemd journal.
+ *
+ * @param message message to log
+ */
+void logDebug(const std::string& message);
+
 } // namespace phosphor::power::regulators::journal
diff --git a/phosphor-regulators/test/mock_journal.cpp b/phosphor-regulators/test/mock_journal.cpp
index 2446182..e5c8ab9 100644
--- a/phosphor-regulators/test/mock_journal.cpp
+++ b/phosphor-regulators/test/mock_journal.cpp
@@ -36,10 +36,16 @@
  */
 static std::vector<std::string> infoMessages{};
 
+/**
+ * Mock journal messages with a priority value of 'DEBUG'.
+ */
+static std::vector<std::string> debugMessages{};
+
 void clear()
 {
     errMessages.clear();
     infoMessages.clear();
+    debugMessages.clear();
 }
 
 const std::vector<std::string>& getErrMessages()
@@ -52,6 +58,11 @@
     return infoMessages;
 }
 
+const std::vector<std::string>& getDebugMessages()
+{
+    return debugMessages;
+}
+
 void logErr(const std::string& message)
 {
     errMessages.emplace_back(message);
@@ -62,4 +73,9 @@
     infoMessages.emplace_back(message);
 }
 
+void logDebug(const std::string& message)
+{
+    debugMessages.emplace_back(message);
+}
+
 } // namespace phosphor::power::regulators::journal
diff --git a/phosphor-regulators/test/mock_journal.hpp b/phosphor-regulators/test/mock_journal.hpp
index 8e2a255..e5729e1 100644
--- a/phosphor-regulators/test/mock_journal.hpp
+++ b/phosphor-regulators/test/mock_journal.hpp
@@ -48,4 +48,11 @@
  */
 const std::vector<std::string>& getInfoMessages();
 
+/**
+ * Returns all mock journal messages with a priority value of 'DEBUG'.
+ *
+ * @return mock debug messages
+ */
+const std::vector<std::string>& getDebugMessages();
+
 } // namespace phosphor::power::regulators::journal