summaryrefslogtreecommitdiffstats
path: root/log_manager.hpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-10-26 18:14:00 -0700
committerPatrick Venture <venture@google.com>2018-10-26 18:16:27 -0700
commitf18bf836d206b1bc5b4fd849127a2e706eddf0aa (patch)
tree5c61f65861a2350f84080f21c6b996d33d0c2ab3 /log_manager.hpp
parentaabb92ef56c4faa8f05487e9fcdf83f1053f1a22 (diff)
downloadphosphor-logging-f18bf836d206b1bc5b4fd849127a2e706eddf0aa.tar.gz
phosphor-logging-f18bf836d206b1bc5b4fd849127a2e706eddf0aa.zip
add .clang-format
Change-Id: I2c36b7886a25d0b235693b0776019d29608e1d52 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'log_manager.hpp')
-rw-r--r--log_manager.hpp339
1 files changed, 169 insertions, 170 deletions
diff --git a/log_manager.hpp b/log_manager.hpp
index 3da450d..864de1a 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -1,22 +1,23 @@
#pragma once
-#include <list>
-#include <sdbusplus/bus.hpp>
-#include <phosphor-logging/log.hpp>
#include "elog_entry.hpp"
-#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
+#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
+
+#include <list>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
namespace phosphor
{
namespace logging
{
-extern const std::map<std::string,std::vector<std::string>> g_errMetaMap;
-extern const std::map<std::string,level> g_errLevelMap;
+extern const std::map<std::string, std::vector<std::string>> g_errMetaMap;
+extern const std::map<std::string, level> g_errLevelMap;
-using DeleteAllIface = sdbusplus::server::object::object <
- sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll >;
+using DeleteAllIface = sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll>;
namespace details
{
@@ -39,142 +40,140 @@ namespace internal
*/
class Manager : public details::ServerObject<details::ManagerIface>
{
- public:
- Manager() = delete;
- Manager(const Manager&) = delete;
- Manager& operator=(const Manager&) = delete;
- Manager(Manager&&) = delete;
- Manager& operator=(Manager&&) = delete;
- virtual ~Manager() = default;
-
- /** @brief Constructor to put object onto bus at a dbus path.
- * @param[in] bus - Bus to attach to.
- * @param[in] path - Path to attach at.
- */
- Manager(sdbusplus::bus::bus& bus, const char* objPath) :
- details::ServerObject<details::ManagerIface>(bus, objPath),
- busLog(bus),
- entryId(0),
- fwVersion(readFWVersion()) {};
-
- /*
- * @fn commit()
- * @brief sd_bus Commit method implementation callback.
- * @details Create an error/event log based on transaction id and
- * error message.
- * @param[in] transactionId - Unique identifier of the journal entries
- * to be committed.
- * @param[in] errMsg - The error exception message associated with the
- * error log to be committed.
- */
- void commit(uint64_t transactionId, std::string errMsg) override;
-
- /*
- * @fn commit()
- * @brief sd_bus CommitWithLvl method implementation callback.
- * @details Create an error/event log based on transaction id and
- * error message.
- * @param[in] transactionId - Unique identifier of the journal entries
- * to be committed.
- * @param[in] errMsg - The error exception message associated with the
- * error log to be committed.
- * @param[in] errLvl - level of the error
- */
- void commitWithLvl(uint64_t transactionId, std::string errMsg,
- uint32_t errLvl) override;
-
- /** @brief Erase specified entry d-bus object
- *
- * @param[in] entryId - unique identifier of the entry
- */
- void erase(uint32_t entryId);
-
- /** @brief Construct error d-bus objects from their persisted
- * representations.
- */
- void restore();
-
- /** @brief Erase all error log entries
- *
- */
- void eraseAll()
+ public:
+ Manager() = delete;
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(Manager&&) = delete;
+ virtual ~Manager() = default;
+
+ /** @brief Constructor to put object onto bus at a dbus path.
+ * @param[in] bus - Bus to attach to.
+ * @param[in] path - Path to attach at.
+ */
+ Manager(sdbusplus::bus::bus& bus, const char* objPath) :
+ details::ServerObject<details::ManagerIface>(bus, objPath), busLog(bus),
+ entryId(0), fwVersion(readFWVersion()){};
+
+ /*
+ * @fn commit()
+ * @brief sd_bus Commit method implementation callback.
+ * @details Create an error/event log based on transaction id and
+ * error message.
+ * @param[in] transactionId - Unique identifier of the journal entries
+ * to be committed.
+ * @param[in] errMsg - The error exception message associated with the
+ * error log to be committed.
+ */
+ void commit(uint64_t transactionId, std::string errMsg) override;
+
+ /*
+ * @fn commit()
+ * @brief sd_bus CommitWithLvl method implementation callback.
+ * @details Create an error/event log based on transaction id and
+ * error message.
+ * @param[in] transactionId - Unique identifier of the journal entries
+ * to be committed.
+ * @param[in] errMsg - The error exception message associated with the
+ * error log to be committed.
+ * @param[in] errLvl - level of the error
+ */
+ void commitWithLvl(uint64_t transactionId, std::string errMsg,
+ uint32_t errLvl) override;
+
+ /** @brief Erase specified entry d-bus object
+ *
+ * @param[in] entryId - unique identifier of the entry
+ */
+ void erase(uint32_t entryId);
+
+ /** @brief Construct error d-bus objects from their persisted
+ * representations.
+ */
+ void restore();
+
+ /** @brief Erase all error log entries
+ *
+ */
+ void eraseAll()
+ {
+ auto iter = entries.begin();
+ while (iter != entries.end())
{
- auto iter = entries.begin();
- while (iter != entries.end())
- {
- auto entry = iter->first;
- ++iter;
- erase(entry);
- }
+ auto entry = iter->first;
+ ++iter;
+ erase(entry);
}
-
- /** @brief Returns the count of high severity errors
- *
- * @return int - count of real errors
- */
- int getRealErrSize();
-
- /** @brief Returns the count of Info errors
- *
- * @return int - count of info errors
- */
- int getInfoErrSize();
-
- private:
- /*
- * @fn _commit()
- * @brief commit() helper
- * @param[in] transactionId - Unique identifier of the journal entries
- * to be committed.
- * @param[in] errMsg - The error exception message associated with the
- * error log to be committed.
- * @param[in] errLvl - level of the error
- */
- void _commit(uint64_t transactionId, std::string&& errMsg,
- Entry::Level errLvl);
-
- /** @brief Call metadata handler(s), if any. Handlers may create
- * associations.
- * @param[in] errorName - name of the error
- * @param[in] additionalData - list of metadata (in key=value format)
- * @param[out] objects - list of error's association objects
- */
- void processMetadata(const std::string& errorName,
- const std::vector<std::string>& additionalData,
- AssociationList& objects) const;
-
- /** @brief Synchronize unwritten journal messages to disk.
- * @details This is the same implementation as the systemd command
- * "journalctl --sync".
- */
- void journalSync();
-
- /** @brief Reads the BMC code level
- *
- * @return std::string - the version string
- */
- static std::string readFWVersion();
-
- /** @brief Persistent sdbusplus DBus bus connection. */
- sdbusplus::bus::bus& busLog;
-
- /** @brief Persistent map of Entry dbus objects and their ID */
- std::map<uint32_t, std::unique_ptr<Entry>> entries;
-
- /** @brief List of error ids for high severity errors */
- std::list<uint32_t> realErrors;
-
- /** @brief List of error ids for Info(and below) severity */
- std::list<uint32_t> infoErrors;
-
- /** @brief Id of last error log entry */
- uint32_t entryId;
-
- /** @brief The BMC firmware version */
- const std::string fwVersion;
+ }
+
+ /** @brief Returns the count of high severity errors
+ *
+ * @return int - count of real errors
+ */
+ int getRealErrSize();
+
+ /** @brief Returns the count of Info errors
+ *
+ * @return int - count of info errors
+ */
+ int getInfoErrSize();
+
+ private:
+ /*
+ * @fn _commit()
+ * @brief commit() helper
+ * @param[in] transactionId - Unique identifier of the journal entries
+ * to be committed.
+ * @param[in] errMsg - The error exception message associated with the
+ * error log to be committed.
+ * @param[in] errLvl - level of the error
+ */
+ void _commit(uint64_t transactionId, std::string&& errMsg,
+ Entry::Level errLvl);
+
+ /** @brief Call metadata handler(s), if any. Handlers may create
+ * associations.
+ * @param[in] errorName - name of the error
+ * @param[in] additionalData - list of metadata (in key=value format)
+ * @param[out] objects - list of error's association objects
+ */
+ void processMetadata(const std::string& errorName,
+ const std::vector<std::string>& additionalData,
+ AssociationList& objects) const;
+
+ /** @brief Synchronize unwritten journal messages to disk.
+ * @details This is the same implementation as the systemd command
+ * "journalctl --sync".
+ */
+ void journalSync();
+
+ /** @brief Reads the BMC code level
+ *
+ * @return std::string - the version string
+ */
+ static std::string readFWVersion();
+
+ /** @brief Persistent sdbusplus DBus bus connection. */
+ sdbusplus::bus::bus& busLog;
+
+ /** @brief Persistent map of Entry dbus objects and their ID */
+ std::map<uint32_t, std::unique_ptr<Entry>> entries;
+
+ /** @brief List of error ids for high severity errors */
+ std::list<uint32_t> realErrors;
+
+ /** @brief List of error ids for Info(and below) severity */
+ std::list<uint32_t> infoErrors;
+
+ /** @brief Id of last error log entry */
+ uint32_t entryId;
+
+ /** @brief The BMC firmware version */
+ const std::string fwVersion;
};
-} //namespace internal
+} // namespace internal
/** @class Manager
* @brief Implementation for delete all error log entries.
@@ -183,36 +182,36 @@ class Manager : public details::ServerObject<details::ManagerIface>
*/
class Manager : public DeleteAllIface
{
- public:
- Manager() = delete;
- Manager(const Manager&) = delete;
- Manager& operator=(const Manager&) = delete;
- Manager(Manager&&) = delete;
- Manager& operator=(Manager&&) = delete;
- virtual ~Manager() = default;
-
- /** @brief Constructor to put object onto bus at a dbus path.
- * Defer signal registration (pass true for deferSignal to the
- * base class) until after the properties are set.
- * @param[in] bus - Bus to attach to.
- * @param[in] path - Path to attach at.
- * @param[in] manager - Reference to internal manager object.
- */
- Manager(sdbusplus::bus::bus& bus,
- const std::string& path,
- internal::Manager& manager) :
- DeleteAllIface(bus, path.c_str(), true),
- manager(manager) {};
-
- /** @brief Delete all d-bus objects.
- */
- void deleteAll()
- {
- manager.eraseAll();
- }
- private:
- /** @brief This is a reference to manager object */
- internal::Manager& manager;
+ public:
+ Manager() = delete;
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(Manager&&) = delete;
+ virtual ~Manager() = default;
+
+ /** @brief Constructor to put object onto bus at a dbus path.
+ * Defer signal registration (pass true for deferSignal to the
+ * base class) until after the properties are set.
+ * @param[in] bus - Bus to attach to.
+ * @param[in] path - Path to attach at.
+ * @param[in] manager - Reference to internal manager object.
+ */
+ Manager(sdbusplus::bus::bus& bus, const std::string& path,
+ internal::Manager& manager) :
+ DeleteAllIface(bus, path.c_str(), true),
+ manager(manager){};
+
+ /** @brief Delete all d-bus objects.
+ */
+ void deleteAll()
+ {
+ manager.eraseAll();
+ }
+
+ private:
+ /** @brief This is a reference to manager object */
+ internal::Manager& manager;
};
} // namespace logging
OpenPOWER on IntegriCloud