diff options
author | Jayanth Othayoth <ojayanth@in.ibm.com> | 2017-09-04 06:26:30 -0500 |
---|---|---|
committer | Jayanth Othayoth <ojayanth@in.ibm.com> | 2017-09-12 04:16:59 -0500 |
commit | d0f0064eb989a93e241c599641654f12141ef636 (patch) | |
tree | 3bd1ea132595363caa1e2dcf8c1fa9ab01cc65ef /elog_watch.hpp | |
parent | d44513c248ef68f6a1e2bc80c925e992b4d38865 (diff) | |
download | phosphor-debug-collector-d0f0064eb989a93e241c599641654f12141ef636.tar.gz phosphor-debug-collector-d0f0064eb989a93e241c599641654f12141ef636.zip |
Capture dump when an error with the name InternalFailure is logged
Change-Id: I2a362b674022dbe1ea8bfe16876d0416f87d0af1
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Diffstat (limited to 'elog_watch.hpp')
-rw-r--r-- | elog_watch.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/elog_watch.hpp b/elog_watch.hpp new file mode 100644 index 0000000..cfdf41a --- /dev/null +++ b/elog_watch.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include <sdbusplus/bus.hpp> +#include <sdbusplus/server.hpp> +#include "config.h" + +#include "dump_manager.hpp" + +namespace phosphor +{ +namespace dump +{ +namespace elog +{ + +using IMgr = phosphor::dump::internal::Manager; + +/** @class Watch + * @brief Adds d-bus signal based watch for elog commit. + * @details This implements methods for watching for InternalFailure + * type error message and call appropriate function to initiate dump + */ +class Watch +{ + public: + Watch() = delete; + ~Watch() = default; + Watch(const Watch&) = delete; + Watch& operator=(const Watch&) = delete; + Watch(Watch&&) = default; + Watch& operator=(Watch&&) = default; + + /** @brief constructs watch for elog commits. + * @param[in] bus - The Dbus bus object + * @param[in] intMgr - Dump internal Manager object + */ + Watch(sdbusplus::bus::bus& bus, IMgr& iMgr): + iMgr(iMgr), + elogMatch( + bus, + sdbusplus::bus::match::rules::interfacesAdded() + + sdbusplus::bus::match::rules::path_namespace( + OBJ_LOGGING), + std::bind(std::mem_fn(&Watch::callback), + this, std::placeholders::_1)) + { + //Do nothing + } + private: + + /** @brief Callback function for error log commit. + * @details InternalError type error message initiates + * Internal error type dump request. + * @param[in] msg - Data associated with subscribed signal + */ + void callback(sdbusplus::message::message& msg); + + /** @brief Dump internal Manager object. */ + IMgr& iMgr; + + /** @brief sdbusplus signal match for elog commit */ + sdbusplus::bus::match_t elogMatch; +}; + +}//namespace elog +}//namespace dump +}//namespace phosphor |