Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 1 | #include <sdbusplus/bus.hpp> |
| 2 | #include <sdbusplus/server/manager.hpp> |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 3 | #include <experimental/filesystem> |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 4 | #include "config.h" |
| 5 | #include "log_manager.hpp" |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 6 | |
| 7 | int main(int argc, char *argv[]) |
| 8 | { |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 9 | auto bus = sdbusplus::bus::new_default(); |
| 10 | |
Adriana Kobylak | 70bb6bc | 2017-02-21 19:51:52 -0600 | [diff] [blame] | 11 | // Add sdbusplus ObjectManager for the 'root' path of the logging manager. |
| 12 | sdbusplus::server::manager::manager objManager(bus, OBJ_LOGGING); |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 13 | |
Nagaraju Goruganti | 05aae8b | 2017-08-30 07:56:12 -0500 | [diff] [blame] | 14 | phosphor::logging::internal::Manager iMgr(bus, OBJ_INTERNAL); |
| 15 | |
| 16 | phosphor::logging::Manager mgr(bus, OBJ_LOGGING, iMgr); |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 17 | |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 18 | // Create a directory to persist errors. |
| 19 | std::experimental::filesystem::create_directories(ERRLOG_PERSIST_PATH); |
| 20 | |
| 21 | // Recreate error d-bus objects from persisted errors. |
Nagaraju Goruganti | 05aae8b | 2017-08-30 07:56:12 -0500 | [diff] [blame] | 22 | iMgr.restore(); |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 23 | |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 24 | bus.request_name(BUSNAME_LOGGING); |
| 25 | |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 26 | while(true) |
| 27 | { |
| 28 | bus.process_discard(); |
| 29 | bus.wait(); |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 30 | } |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 31 | |
| 32 | return 0; |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 33 | } |