18f7941edSAdriana Kobylak #pragma once
28f7941edSAdriana Kobylak 
36a0ef6f5SAndrew Geissler #include "elog_block.hpp"
4df995fafSAdriana Kobylak #include "elog_entry.hpp"
505aae8bcSNagaraju Goruganti #include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
63fb83b37SMatt Spinler #include "xyz/openbmc_project/Logging/Create/server.hpp"
73fb83b37SMatt Spinler #include "xyz/openbmc_project/Logging/Entry/server.hpp"
8f18bf836SPatrick Venture #include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
96f533669SBonnieLo-wiwynn #include "xyz/openbmc_project/Logging/error.hpp"
10f18bf836SPatrick Venture 
11f18bf836SPatrick Venture #include <phosphor-logging/log.hpp>
12f18bf836SPatrick Venture #include <sdbusplus/bus.hpp>
138f7941edSAdriana Kobylak 
142544b419SPatrick Williams #include <list>
152544b419SPatrick Williams 
168f7941edSAdriana Kobylak namespace phosphor
178f7941edSAdriana Kobylak {
188f7941edSAdriana Kobylak namespace logging
198f7941edSAdriana Kobylak {
20d722b3aaSAdriana Kobylak 
21d722b3aaSAdriana Kobylak extern const std::map<std::string, std::vector<std::string>> g_errMetaMap;
22d722b3aaSAdriana Kobylak extern const std::map<std::string, level> g_errLevelMap;
23d722b3aaSAdriana Kobylak 
246ddbf69eSWilly Tu using CreateIface = sdbusplus::server::xyz::openbmc_project::logging::Create;
253fb83b37SMatt Spinler using DeleteAllIface =
266ddbf69eSWilly Tu     sdbusplus::server::xyz::openbmc_project::collection::DeleteAll;
2705aae8bcSNagaraju Goruganti 
286f533669SBonnieLo-wiwynn using Severity = sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level;
296f533669SBonnieLo-wiwynn using LogsCleared =
306f533669SBonnieLo-wiwynn     sdbusplus::xyz::openbmc_project::Logging::Error::LogsCleared;
316f533669SBonnieLo-wiwynn 
328f7941edSAdriana Kobylak namespace details
338f7941edSAdriana Kobylak {
343fb83b37SMatt Spinler template <typename... T>
3545e83521SPatrick Williams using ServerObject = typename sdbusplus::server::object_t<T...>;
368f7941edSAdriana Kobylak 
378f7941edSAdriana Kobylak using ManagerIface =
386ddbf69eSWilly Tu     sdbusplus::server::xyz::openbmc_project::logging::internal::Manager;
398f7941edSAdriana Kobylak 
408f7941edSAdriana Kobylak } // namespace details
418f7941edSAdriana Kobylak 
42c64b7122SMatt Spinler constexpr size_t ffdcFormatPos = 0;
43c64b7122SMatt Spinler constexpr size_t ffdcSubtypePos = 1;
44c64b7122SMatt Spinler constexpr size_t ffdcVersionPos = 2;
45c64b7122SMatt Spinler constexpr size_t ffdcFDPos = 3;
46c64b7122SMatt Spinler 
47c64b7122SMatt Spinler using FFDCEntry = std::tuple<CreateIface::FFDCFormat, uint8_t, uint8_t,
48c64b7122SMatt Spinler                              sdbusplus::message::unix_fd>;
49c64b7122SMatt Spinler 
50c64b7122SMatt Spinler using FFDCEntries = std::vector<FFDCEntry>;
51c64b7122SMatt Spinler 
5205aae8bcSNagaraju Goruganti namespace internal
5305aae8bcSNagaraju Goruganti {
5405aae8bcSNagaraju Goruganti 
558f7941edSAdriana Kobylak /** @class Manager
568f7941edSAdriana Kobylak  *  @brief OpenBMC logging manager implementation.
578f7941edSAdriana Kobylak  *  @details A concrete implementation for the
588f7941edSAdriana Kobylak  *  xyz.openbmc_project.Logging.Internal.Manager DBus API.
598f7941edSAdriana Kobylak  */
60f477fe29SAdriana Kobylak class Manager : public details::ServerObject<details::ManagerIface>
618f7941edSAdriana Kobylak {
628f7941edSAdriana Kobylak   public:
638f7941edSAdriana Kobylak     Manager() = delete;
648f7941edSAdriana Kobylak     Manager(const Manager&) = delete;
658f7941edSAdriana Kobylak     Manager& operator=(const Manager&) = delete;
66f477fe29SAdriana Kobylak     Manager(Manager&&) = delete;
67f477fe29SAdriana Kobylak     Manager& operator=(Manager&&) = delete;
68f477fe29SAdriana Kobylak     virtual ~Manager() = default;
698f7941edSAdriana Kobylak 
70f477fe29SAdriana Kobylak     /** @brief Constructor to put object onto bus at a dbus path.
71f477fe29SAdriana Kobylak      *  @param[in] bus - Bus to attach to.
72f477fe29SAdriana Kobylak      *  @param[in] path - Path to attach at.
738f7941edSAdriana Kobylak      */
Manager(sdbusplus::bus_t & bus,const char * objPath)7445e83521SPatrick Williams     Manager(sdbusplus::bus_t& bus, const char* objPath) :
75f18bf836SPatrick Venture         details::ServerObject<details::ManagerIface>(bus, objPath), busLog(bus),
76f18bf836SPatrick Venture         entryId(0), fwVersion(readFWVersion()) {};
778f7941edSAdriana Kobylak 
788f7941edSAdriana Kobylak     /*
798f7941edSAdriana Kobylak      * @fn commit()
808f7941edSAdriana Kobylak      * @brief sd_bus Commit method implementation callback.
818f7941edSAdriana Kobylak      * @details Create an error/event log based on transaction id and
828f7941edSAdriana Kobylak      *          error message.
838f7941edSAdriana Kobylak      * @param[in] transactionId - Unique identifier of the journal entries
848f7941edSAdriana Kobylak      *                            to be committed.
858f7941edSAdriana Kobylak      * @param[in] errMsg - The error exception message associated with the
868f7941edSAdriana Kobylak      *                     error log to be committed.
878f7941edSAdriana Kobylak      */
88b50c705cSLei YU     uint32_t commit(uint64_t transactionId, std::string errMsg) override;
89df995fafSAdriana Kobylak 
906fd9dc48SDeepak Kodihalli     /*
916fd9dc48SDeepak Kodihalli      * @fn commit()
926fd9dc48SDeepak Kodihalli      * @brief sd_bus CommitWithLvl method implementation callback.
936fd9dc48SDeepak Kodihalli      * @details Create an error/event log based on transaction id and
946fd9dc48SDeepak Kodihalli      *          error message.
956fd9dc48SDeepak Kodihalli      * @param[in] transactionId - Unique identifier of the journal entries
966fd9dc48SDeepak Kodihalli      *                            to be committed.
976fd9dc48SDeepak Kodihalli      * @param[in] errMsg - The error exception message associated with the
986fd9dc48SDeepak Kodihalli      *                     error log to be committed.
996fd9dc48SDeepak Kodihalli      * @param[in] errLvl - level of the error
1006fd9dc48SDeepak Kodihalli      */
101b50c705cSLei YU     uint32_t commitWithLvl(uint64_t transactionId, std::string errMsg,
1026fd9dc48SDeepak Kodihalli                            uint32_t errLvl) override;
103df995fafSAdriana Kobylak 
10499a8549eSDeepak Kodihalli     /** @brief Erase specified entry d-bus object
10599a8549eSDeepak Kodihalli      *
10699a8549eSDeepak Kodihalli      * @param[in] entryId - unique identifier of the entry
10799a8549eSDeepak Kodihalli      */
10899a8549eSDeepak Kodihalli     void erase(uint32_t entryId);
10999a8549eSDeepak Kodihalli 
11072654f10SDeepak Kodihalli     /** @brief Construct error d-bus objects from their persisted
11172654f10SDeepak Kodihalli      *         representations.
11272654f10SDeepak Kodihalli      */
11372654f10SDeepak Kodihalli     void restore();
11472654f10SDeepak Kodihalli 
11505aae8bcSNagaraju Goruganti     /** @brief  Erase all error log entries
11605aae8bcSNagaraju Goruganti      *
1176f533669SBonnieLo-wiwynn      *  @return size_t - count of erased entries
11805aae8bcSNagaraju Goruganti      */
119*d763db35Sharsh-agarwal1     size_t eraseAll();
12005aae8bcSNagaraju Goruganti 
121477b731aSNagaraju Goruganti     /** @brief Returns the count of high severity errors
122477b731aSNagaraju Goruganti      *
123477b731aSNagaraju Goruganti      *  @return int - count of real errors
124477b731aSNagaraju Goruganti      */
125477b731aSNagaraju Goruganti     int getRealErrSize();
126477b731aSNagaraju Goruganti 
127477b731aSNagaraju Goruganti     /** @brief Returns the count of Info errors
128477b731aSNagaraju Goruganti      *
129477b731aSNagaraju Goruganti      *  @return int - count of info errors
130477b731aSNagaraju Goruganti      */
131477b731aSNagaraju Goruganti     int getInfoErrSize();
132477b731aSNagaraju Goruganti 
1336a0ef6f5SAndrew Geissler     /** @brief Returns the number of blocking errors
1346a0ef6f5SAndrew Geissler      *
1356a0ef6f5SAndrew Geissler      *  @return int - count of blocking errors
1366a0ef6f5SAndrew Geissler      */
getBlockingErrSize()1376a0ef6f5SAndrew Geissler     int getBlockingErrSize()
1386a0ef6f5SAndrew Geissler     {
1396a0ef6f5SAndrew Geissler         return blockingErrors.size();
1406a0ef6f5SAndrew Geissler     }
1416a0ef6f5SAndrew Geissler 
1427f6d4bcfSAndrew Geissler     /** @brief Returns the number of property change callback objects
1437f6d4bcfSAndrew Geissler      *
1447f6d4bcfSAndrew Geissler      *  @return int - count of property callback entries
1457f6d4bcfSAndrew Geissler      */
getEntryCallbackSize()1467f6d4bcfSAndrew Geissler     int getEntryCallbackSize()
1477f6d4bcfSAndrew Geissler     {
1487f6d4bcfSAndrew Geissler         return propChangedEntryCallback.size();
1497f6d4bcfSAndrew Geissler     }
1507f6d4bcfSAndrew Geissler 
15144893cc9SMatt Spinler     /**
15244893cc9SMatt Spinler      * @brief Returns the sdbusplus bus object
15344893cc9SMatt Spinler      *
15445e83521SPatrick Williams      * @return sdbusplus::bus_t&
15544893cc9SMatt Spinler      */
getBus()15645e83521SPatrick Williams     sdbusplus::bus_t& getBus()
1578ebfd312SMatt Spinler     {
1588ebfd312SMatt Spinler         return busLog;
1598ebfd312SMatt Spinler     }
1608ebfd312SMatt Spinler 
16144893cc9SMatt Spinler     /**
16244893cc9SMatt Spinler      * @brief Returns the ID of the last created entry
16344893cc9SMatt Spinler      *
16444893cc9SMatt Spinler      * @return uint32_t - The ID
16544893cc9SMatt Spinler      */
lastEntryID() const16644893cc9SMatt Spinler     uint32_t lastEntryID() const
16744893cc9SMatt Spinler     {
16844893cc9SMatt Spinler         return entryId;
16944893cc9SMatt Spinler     }
17044893cc9SMatt Spinler 
1713fb83b37SMatt Spinler     /** @brief Creates an event log
1723fb83b37SMatt Spinler      *
1733fb83b37SMatt Spinler      *  This is an alternative to the _commit() API.  It doesn't use
1743fb83b37SMatt Spinler      *  the journal to look up event log metadata like _commit does.
1753fb83b37SMatt Spinler      *
1763fb83b37SMatt Spinler      * @param[in] errMsg - The error exception message associated with the
1773fb83b37SMatt Spinler      *                     error log to be committed.
1783fb83b37SMatt Spinler      * @param[in] severity - level of the error
1793fb83b37SMatt Spinler      * @param[in] additionalData - The AdditionalData property for the error
180221b79b3SPaul Fertser      * @param[in] ffdc - A vector of tuples that allows one to pass in file
181221b79b3SPaul Fertser      *                   descriptors for files that contain FFDC (First
182221b79b3SPaul Fertser      *                   Failure Data Capture). These will be passed to any
183221b79b3SPaul Fertser      *                   event logging extensions.
1843fb83b37SMatt Spinler      */
1856f533669SBonnieLo-wiwynn     void create(const std::string& message, Severity severity,
186c64b7122SMatt Spinler                 const std::map<std::string, std::string>& additionalData,
187221b79b3SPaul Fertser                 const FFDCEntries& ffdc = FFDCEntries{});
188c64b7122SMatt Spinler 
189c0c500efSAndrew Geissler     /** @brief Common wrapper for creating an Entry object
190c0c500efSAndrew Geissler      *
191c0c500efSAndrew Geissler      * @return true if quiesce on error setting is enabled, false otherwise
192c0c500efSAndrew Geissler      */
193c0c500efSAndrew Geissler     bool isQuiesceOnErrorEnabled();
194c0c500efSAndrew Geissler 
19532874543SAndrew Geissler     /** @brief Create boot block association and quiesce host if running
196c0c500efSAndrew Geissler      *
19732874543SAndrew Geissler      * @param[in] entryId - The ID of the phosphor logging error
198c0c500efSAndrew Geissler      */
19932874543SAndrew Geissler     void quiesceOnError(const uint32_t entryId);
200c0c500efSAndrew Geissler 
201e4960ee7SAndrew Geissler     /** @brief Check if inventory callout present in input entry
202e4960ee7SAndrew Geissler      *
203e4960ee7SAndrew Geissler      * @param[in] entry - The error to check for callouts
204e4960ee7SAndrew Geissler      *
205e4960ee7SAndrew Geissler      * @return true if inventory item in associations, false otherwise
206e4960ee7SAndrew Geissler      */
207e4960ee7SAndrew Geissler     bool isCalloutPresent(const Entry& entry);
208e4960ee7SAndrew Geissler 
209ced6e2a0SAndrew Geissler     /** @brief Check (and remove) entry being erased from blocking errors
210ced6e2a0SAndrew Geissler      *
211ced6e2a0SAndrew Geissler      * @param[in] entryId - The entry that is being erased
212ced6e2a0SAndrew Geissler      */
213ced6e2a0SAndrew Geissler     void checkAndRemoveBlockingError(uint32_t entryId);
214ced6e2a0SAndrew Geissler 
215e7d271aeSAdriana Kobylak     /** @brief Persistent map of Entry dbus objects and their ID */
216e7d271aeSAdriana Kobylak     std::map<uint32_t, std::unique_ptr<Entry>> entries;
217e7d271aeSAdriana Kobylak 
218df995fafSAdriana Kobylak   private:
2196fd9dc48SDeepak Kodihalli     /*
2206fd9dc48SDeepak Kodihalli      * @fn _commit()
2216fd9dc48SDeepak Kodihalli      * @brief commit() helper
2226fd9dc48SDeepak Kodihalli      * @param[in] transactionId - Unique identifier of the journal entries
2236fd9dc48SDeepak Kodihalli      *                            to be committed.
2246fd9dc48SDeepak Kodihalli      * @param[in] errMsg - The error exception message associated with the
2256fd9dc48SDeepak Kodihalli      *                     error log to be committed.
2266fd9dc48SDeepak Kodihalli      * @param[in] errLvl - level of the error
2276fd9dc48SDeepak Kodihalli      */
2286fd9dc48SDeepak Kodihalli     void _commit(uint64_t transactionId, std::string&& errMsg,
2296fd9dc48SDeepak Kodihalli                  Entry::Level errLvl);
2306fd9dc48SDeepak Kodihalli 
231a87c157cSDeepak Kodihalli     /** @brief Call metadata handler(s), if any. Handlers may create
232a87c157cSDeepak Kodihalli      *         associations.
233a87c157cSDeepak Kodihalli      *  @param[in] errorName - name of the error
234a87c157cSDeepak Kodihalli      *  @param[in] additionalData - list of metadata (in key=value format)
235a87c157cSDeepak Kodihalli      *  @param[out] objects - list of error's association objects
236a87c157cSDeepak Kodihalli      */
237a87c157cSDeepak Kodihalli     void processMetadata(const std::string& errorName,
238a87c157cSDeepak Kodihalli                          const std::vector<std::string>& additionalData,
239a87c157cSDeepak Kodihalli                          AssociationList& objects) const;
240a87c157cSDeepak Kodihalli 
2411275bd13SMatt Spinler     /** @brief Reads the BMC code level
2421275bd13SMatt Spinler      *
2431275bd13SMatt Spinler      *  @return std::string - the version string
2441275bd13SMatt Spinler      */
2451275bd13SMatt Spinler     static std::string readFWVersion();
2461275bd13SMatt Spinler 
24799c2b405SMatt Spinler     /** @brief Call any create() functions provided by any extensions.
24899c2b405SMatt Spinler      *  This is called right after an event log is created to allow
24999c2b405SMatt Spinler      *  extensions to create their own log based on this one.
25099c2b405SMatt Spinler      *
25199c2b405SMatt Spinler      *  @param[in] entry - the new event log entry
252c64b7122SMatt Spinler      *  @param[in] ffdc - A vector of FFDC file info
25399c2b405SMatt Spinler      */
254c64b7122SMatt Spinler     void doExtensionLogCreate(const Entry& entry, const FFDCEntries& ffdc);
25599c2b405SMatt Spinler 
256b60e7559SMatt Spinler     /** @brief Common wrapper for creating an Entry object
257b60e7559SMatt Spinler      *
258b60e7559SMatt Spinler      * @param[in] errMsg - The error exception message associated with the
259b60e7559SMatt Spinler      *                     error log to be committed.
260b60e7559SMatt Spinler      * @param[in] errLvl - level of the error
261b60e7559SMatt Spinler      * @param[in] additionalData - The AdditionalData property for the error
262c64b7122SMatt Spinler      * @param[in] ffdc - A vector of FFDC file info. Defaults to an empty
263c64b7122SMatt Spinler      * vector.
264b60e7559SMatt Spinler      */
265b60e7559SMatt Spinler     void createEntry(std::string errMsg, Entry::Level errLvl,
266c64b7122SMatt Spinler                      std::vector<std::string> additionalData,
267c64b7122SMatt Spinler                      const FFDCEntries& ffdc = FFDCEntries{});
268b60e7559SMatt Spinler 
2697f6d4bcfSAndrew Geissler     /** @brief Notified on entry property changes
2707f6d4bcfSAndrew Geissler      *
2717f6d4bcfSAndrew Geissler      * If an entry is blocking, this callback will be registered to monitor for
2727f6d4bcfSAndrew Geissler      * the entry having it's Resolved field set to true. If it is then remove
2737f6d4bcfSAndrew Geissler      * the blocking object.
2747f6d4bcfSAndrew Geissler      *
2757f6d4bcfSAndrew Geissler      * @param[in] msg - sdbusplus dbusmessage
2767f6d4bcfSAndrew Geissler      */
27745e83521SPatrick Williams     void onEntryResolve(sdbusplus::message_t& msg);
2787f6d4bcfSAndrew Geissler 
2797f6d4bcfSAndrew Geissler     /** @brief Remove block objects for any resolved entries  */
2807f6d4bcfSAndrew Geissler     void findAndRemoveResolvedBlocks();
2817f6d4bcfSAndrew Geissler 
282f6126a78SAndrew Geissler     /** @brief Quiesce host if it is running
283f6126a78SAndrew Geissler      *
284f6126a78SAndrew Geissler      * This is called when the user has requested the system be quiesced
285f6126a78SAndrew Geissler      * if a log with a callout is created
286f6126a78SAndrew Geissler      */
287f6126a78SAndrew Geissler     void checkAndQuiesceHost();
288f6126a78SAndrew Geissler 
289df995fafSAdriana Kobylak     /** @brief Persistent sdbusplus DBus bus connection. */
29045e83521SPatrick Williams     sdbusplus::bus_t& busLog;
291df995fafSAdriana Kobylak 
292e4b0b771SNagaraju Goruganti     /** @brief List of error ids for high severity errors */
293e4b0b771SNagaraju Goruganti     std::list<uint32_t> realErrors;
294e4b0b771SNagaraju Goruganti 
295f8a5a797SNagaraju Goruganti     /** @brief List of error ids for Info(and below) severity */
296f8a5a797SNagaraju Goruganti     std::list<uint32_t> infoErrors;
297f8a5a797SNagaraju Goruganti 
2984ea7f312SAdriana Kobylak     /** @brief Id of last error log entry */
2994ea7f312SAdriana Kobylak     uint32_t entryId;
3001275bd13SMatt Spinler 
3011275bd13SMatt Spinler     /** @brief The BMC firmware version */
3021275bd13SMatt Spinler     const std::string fwVersion;
3036a0ef6f5SAndrew Geissler 
3046a0ef6f5SAndrew Geissler     /** @brief Array of blocking errors */
3056a0ef6f5SAndrew Geissler     std::vector<std::unique_ptr<Block>> blockingErrors;
3067f6d4bcfSAndrew Geissler 
3077f6d4bcfSAndrew Geissler     /** @brief Map of entry id to call back object on properties changed */
30845e83521SPatrick Williams     std::map<uint32_t, std::unique_ptr<sdbusplus::bus::match_t>>
3097f6d4bcfSAndrew Geissler         propChangedEntryCallback;
3108f7941edSAdriana Kobylak };
3118f7941edSAdriana Kobylak 
31205aae8bcSNagaraju Goruganti } // namespace internal
31305aae8bcSNagaraju Goruganti 
31405aae8bcSNagaraju Goruganti /** @class Manager
3153fb83b37SMatt Spinler  *  @brief Implementation for deleting all error log entries and
3163fb83b37SMatt Spinler  *         creating new logs.
31705aae8bcSNagaraju Goruganti  *  @details A concrete implementation for the
3183fb83b37SMatt Spinler  *           xyz.openbmc_project.Collection.DeleteAll and
3193fb83b37SMatt Spinler  *           xyz.openbmc_project.Logging.Create interfaces.
32005aae8bcSNagaraju Goruganti  */
3213fb83b37SMatt Spinler class Manager : public details::ServerObject<DeleteAllIface, CreateIface>
32205aae8bcSNagaraju Goruganti {
32305aae8bcSNagaraju Goruganti   public:
32405aae8bcSNagaraju Goruganti     Manager() = delete;
32505aae8bcSNagaraju Goruganti     Manager(const Manager&) = delete;
32605aae8bcSNagaraju Goruganti     Manager& operator=(const Manager&) = delete;
32705aae8bcSNagaraju Goruganti     Manager(Manager&&) = delete;
32805aae8bcSNagaraju Goruganti     Manager& operator=(Manager&&) = delete;
32905aae8bcSNagaraju Goruganti     virtual ~Manager() = default;
33005aae8bcSNagaraju Goruganti 
33105aae8bcSNagaraju Goruganti     /** @brief Constructor to put object onto bus at a dbus path.
33205aae8bcSNagaraju Goruganti      *         Defer signal registration (pass true for deferSignal to the
33305aae8bcSNagaraju Goruganti      *         base class) until after the properties are set.
33405aae8bcSNagaraju Goruganti      *  @param[in] bus - Bus to attach to.
33505aae8bcSNagaraju Goruganti      *  @param[in] path - Path to attach at.
33605aae8bcSNagaraju Goruganti      *  @param[in] manager - Reference to internal manager object.
33705aae8bcSNagaraju Goruganti      */
Manager(sdbusplus::bus_t & bus,const std::string & path,internal::Manager & manager)33845e83521SPatrick Williams     Manager(sdbusplus::bus_t& bus, const std::string& path,
33905aae8bcSNagaraju Goruganti             internal::Manager& manager) :
3406ef6b25eSPatrick Williams         details::ServerObject<DeleteAllIface, CreateIface>(
3416ef6b25eSPatrick Williams             bus, path.c_str(),
3426ef6b25eSPatrick Williams             details::ServerObject<DeleteAllIface,
3436ef6b25eSPatrick Williams                                   CreateIface>::action::defer_emit),
34405aae8bcSNagaraju Goruganti         manager(manager) {};
34505aae8bcSNagaraju Goruganti 
34605aae8bcSNagaraju Goruganti     /** @brief Delete all d-bus objects.
34705aae8bcSNagaraju Goruganti      */
deleteAll()348ec4eaea9SPatrick Williams     void deleteAll() override
34905aae8bcSNagaraju Goruganti     {
350f6f51230SMatt Spinler         log<level::INFO>("Deleting all log entries");
3516f533669SBonnieLo-wiwynn         auto numbersOfLogs = manager.eraseAll();
3526f533669SBonnieLo-wiwynn         std::map<std::string, std::string> additionalData;
3536f533669SBonnieLo-wiwynn         additionalData.emplace("NUM_LOGS", std::to_string(numbersOfLogs));
3546f533669SBonnieLo-wiwynn         manager.create(LogsCleared::errName, Severity::Informational,
3556f533669SBonnieLo-wiwynn                        additionalData);
35605aae8bcSNagaraju Goruganti     }
357f18bf836SPatrick Venture 
3583fb83b37SMatt Spinler     /** @brief D-Bus method call implementation to create an event log.
3593fb83b37SMatt Spinler      *
3603fb83b37SMatt Spinler      * @param[in] errMsg - The error exception message associated with the
3613fb83b37SMatt Spinler      *                     error log to be committed.
3623fb83b37SMatt Spinler      * @param[in] severity - Level of the error
3633fb83b37SMatt Spinler      * @param[in] additionalData - The AdditionalData property for the error
3643fb83b37SMatt Spinler      */
create(std::string message,Severity severity,std::map<std::string,std::string> additionalData)3656f533669SBonnieLo-wiwynn     void create(std::string message, Severity severity,
3663fb83b37SMatt Spinler                 std::map<std::string, std::string> additionalData) override
3673fb83b37SMatt Spinler     {
3683fb83b37SMatt Spinler         manager.create(message, severity, additionalData);
3693fb83b37SMatt Spinler     }
3703fb83b37SMatt Spinler 
371c64b7122SMatt Spinler     /** @brief D-Bus method call implementation to create an event log with FFDC
372c64b7122SMatt Spinler      *
373c64b7122SMatt Spinler      * The same as create(), but takes an extra FFDC argument.
374c64b7122SMatt Spinler      *
375c64b7122SMatt Spinler      * @param[in] errMsg - The error exception message associated with the
376c64b7122SMatt Spinler      *                     error log to be committed.
377c64b7122SMatt Spinler      * @param[in] severity - Level of the error
378c64b7122SMatt Spinler      * @param[in] additionalData - The AdditionalData property for the error
379c64b7122SMatt Spinler      * @param[in] ffdc - A vector of FFDC file info
380c64b7122SMatt Spinler      */
createWithFFDCFiles(std::string message,Severity severity,std::map<std::string,std::string> additionalData,std::vector<std::tuple<CreateIface::FFDCFormat,uint8_t,uint8_t,sdbusplus::message::unix_fd>> ffdc)381fcbaf3e8SMatt Spinler     void createWithFFDCFiles(
3826f533669SBonnieLo-wiwynn         std::string message, Severity severity,
383fcbaf3e8SMatt Spinler         std::map<std::string, std::string> additionalData,
384fcbaf3e8SMatt Spinler         std::vector<std::tuple<CreateIface::FFDCFormat, uint8_t, uint8_t,
385fcbaf3e8SMatt Spinler                                sdbusplus::message::unix_fd>>
386fcbaf3e8SMatt Spinler             ffdc) override
387fcbaf3e8SMatt Spinler     {
388221b79b3SPaul Fertser         manager.create(message, severity, additionalData, ffdc);
389fcbaf3e8SMatt Spinler     }
390fcbaf3e8SMatt Spinler 
39105aae8bcSNagaraju Goruganti   private:
39205aae8bcSNagaraju Goruganti     /** @brief This is a reference to manager object */
39305aae8bcSNagaraju Goruganti     internal::Manager& manager;
39405aae8bcSNagaraju Goruganti };
39505aae8bcSNagaraju Goruganti 
3968f7941edSAdriana Kobylak } // namespace logging
3978f7941edSAdriana Kobylak } // namespace phosphor
398