Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 1 | #include "elog_entry.hpp" |
| 2 | #include "extensions.hpp" |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 3 | #include "manager.hpp" |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 4 | |
| 5 | namespace openpower |
| 6 | { |
| 7 | namespace pels |
| 8 | { |
| 9 | |
| 10 | using namespace phosphor::logging; |
| 11 | |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 12 | std::unique_ptr<Manager> manager; |
| 13 | |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 14 | DISABLE_LOG_ENTRY_CAPS(); |
| 15 | |
| 16 | void pelStartup(internal::Manager& logManager) |
| 17 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 18 | manager = std::make_unique<Manager>(logManager); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | REGISTER_EXTENSION_FUNCTION(pelStartup); |
| 22 | |
| 23 | void pelCreate(const std::string& message, uint32_t id, uint64_t timestamp, |
| 24 | Entry::Level severity, const AdditionalDataArg& additionalData, |
| 25 | const AssociationEndpointsArg& assocs) |
| 26 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 27 | manager->create(message, id, timestamp, severity, additionalData, assocs); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | REGISTER_EXTENSION_FUNCTION(pelCreate); |
| 31 | |
| 32 | void pelDelete(uint32_t id) |
| 33 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 34 | return manager->erase(id); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | REGISTER_EXTENSION_FUNCTION(pelDelete); |
| 38 | |
| 39 | void pelDeleteProhibited(uint32_t id, bool& prohibited) |
| 40 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 41 | prohibited = manager->isDeleteProhibited(id); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | REGISTER_EXTENSION_FUNCTION(pelDeleteProhibited); |
| 45 | |
| 46 | } // namespace pels |
| 47 | } // namespace openpower |