blob: 48a7deef7f5755d778c7a62747874d0b63d3d379 [file] [log] [blame]
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06001#include "config.h"
Patrick Venturef18bf832018-10-26 18:14:00 -07002
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06003#include "log_manager.hpp"
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06004
Patrick Venturef18bf832018-10-26 18:14:00 -07005#include <experimental/filesystem>
6#include <sdbusplus/bus.hpp>
7#include <sdbusplus/server/manager.hpp>
8
9int main(int argc, char* argv[])
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060010{
Adriana Kobylakf477fe22017-01-06 11:56:41 -060011 auto bus = sdbusplus::bus::new_default();
12
Adriana Kobylak70bb6bc2017-02-21 19:51:52 -060013 // Add sdbusplus ObjectManager for the 'root' path of the logging manager.
14 sdbusplus::server::manager::manager objManager(bus, OBJ_LOGGING);
Adriana Kobylakf477fe22017-01-06 11:56:41 -060015
Nagaraju Goruganti05aae8b2017-08-30 07:56:12 -050016 phosphor::logging::internal::Manager iMgr(bus, OBJ_INTERNAL);
17
18 phosphor::logging::Manager mgr(bus, OBJ_LOGGING, iMgr);
Adriana Kobylakf477fe22017-01-06 11:56:41 -060019
Deepak Kodihalli72654f12017-06-12 04:33:29 -050020 // 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 Goruganti05aae8b2017-08-30 07:56:12 -050024 iMgr.restore();
Deepak Kodihalli72654f12017-06-12 04:33:29 -050025
Adriana Kobylakf477fe22017-01-06 11:56:41 -060026 bus.request_name(BUSNAME_LOGGING);
27
Patrick Venturef18bf832018-10-26 18:14:00 -070028 while (true)
Adriana Kobylakf477fe22017-01-06 11:56:41 -060029 {
30 bus.process_discard();
31 bus.wait();
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060032 }
Adriana Kobylakf477fe22017-01-06 11:56:41 -060033
34 return 0;
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060035}