regulators: Add toString() method to Action class
Add a toString() method to the Action class and all child classes.
This method returns a string description of the action. The description
will be used in journal entries and error logs when an action fails
(such as due to an I2C error).
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I083496d23bf9c3df5be1b082650a9def24be1b00
diff --git a/phosphor-regulators/test/actions/mock_action.hpp b/phosphor-regulators/test/actions/mock_action.hpp
index 84455dd..bb48960 100644
--- a/phosphor-regulators/test/actions/mock_action.hpp
+++ b/phosphor-regulators/test/actions/mock_action.hpp
@@ -18,6 +18,8 @@
#include "action.hpp"
#include "action_environment.hpp"
+#include <string>
+
#include <gmock/gmock.h>
namespace phosphor::power::regulators
@@ -35,6 +37,7 @@
virtual ~MockAction() = default;
MOCK_METHOD(bool, execute, (ActionEnvironment & environment), (override));
+ MOCK_METHOD(std::string, toString, (), (const, override));
};
} // namespace phosphor::power::regulators