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/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