blob: 5adeb40ba4b70348c544e6dac18bcf86d94f2f8d [file] [log] [blame]
Matt Spinler99c2b402019-05-23 14:29:16 -05001#include "elog_entry.hpp"
2#include "extensions.hpp"
Matt Spinler4e8078c2019-07-09 13:22:32 -05003#include "manager.hpp"
Matt Spinler99c2b402019-05-23 14:29:16 -05004
5namespace openpower
6{
7namespace pels
8{
9
10using namespace phosphor::logging;
11
Matt Spinler4e8078c2019-07-09 13:22:32 -050012std::unique_ptr<Manager> manager;
13
Matt Spinler99c2b402019-05-23 14:29:16 -050014DISABLE_LOG_ENTRY_CAPS();
15
16void pelStartup(internal::Manager& logManager)
17{
Matt Spinler4e8078c2019-07-09 13:22:32 -050018 manager = std::make_unique<Manager>(logManager);
Matt Spinler99c2b402019-05-23 14:29:16 -050019}
20
21REGISTER_EXTENSION_FUNCTION(pelStartup);
22
23void pelCreate(const std::string& message, uint32_t id, uint64_t timestamp,
24 Entry::Level severity, const AdditionalDataArg& additionalData,
25 const AssociationEndpointsArg& assocs)
26{
Matt Spinler4e8078c2019-07-09 13:22:32 -050027 manager->create(message, id, timestamp, severity, additionalData, assocs);
Matt Spinler99c2b402019-05-23 14:29:16 -050028}
29
30REGISTER_EXTENSION_FUNCTION(pelCreate);
31
32void pelDelete(uint32_t id)
33{
Matt Spinler4e8078c2019-07-09 13:22:32 -050034 return manager->erase(id);
Matt Spinler99c2b402019-05-23 14:29:16 -050035}
36
37REGISTER_EXTENSION_FUNCTION(pelDelete);
38
39void pelDeleteProhibited(uint32_t id, bool& prohibited)
40{
Matt Spinler4e8078c2019-07-09 13:22:32 -050041 prohibited = manager->isDeleteProhibited(id);
Matt Spinler99c2b402019-05-23 14:29:16 -050042}
43
44REGISTER_EXTENSION_FUNCTION(pelDeleteProhibited);
45
46} // namespace pels
47} // namespace openpower