Add new commit API and deprecate older commit method

Added new commit method that accepts an sdbusplus exception
Deprecate commit which accepts an exception name

Change-Id: I9b5c91eb13466eb576c329ebb7fd00ce33f7dd9f
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/elog.cpp b/elog.cpp
index 5483851..27dfef5 100644
--- a/elog.cpp
+++ b/elog.cpp
@@ -5,9 +5,11 @@
 {
 namespace logging
 {
-
-void commit(std::string&& e)
+namespace details
 {
+void commit(const char* name)
+{
+    using phosphor::logging::log;
     constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
     constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
     constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
@@ -46,9 +48,16 @@
             IFACE_INTERNAL,
             "Commit");
     uint64_t id = sdbusplus::server::transaction::get_id();
-    m.append(id, std::forward<std::string>(e));
+    m.append(id, name);
     b.call_noreply(m);
 }
+} // namespace details
+
+void commit(std::string&& name)
+{
+    log<level::ERR>("method is deprecated, use commit() with exception type");
+    phosphor::logging::details::commit(name.c_str());
+}
 
 } // namespace logging
 } // namespace phosphor