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