blob: f06a79d687b03ed93c9f7ae53ee7958255a09d69 [file] [log] [blame]
Adriana Kobylakf477fe22017-01-06 11:56:41 -06001#include <sdbusplus/bus.hpp>
2#include <sdbusplus/server/manager.hpp>
Deepak Kodihalli72654f12017-06-12 04:33:29 -05003#include <experimental/filesystem>
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06004#include "config.h"
5#include "log_manager.hpp"
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06006
7int main(int argc, char *argv[])
8{
Adriana Kobylakf477fe22017-01-06 11:56:41 -06009 auto bus = sdbusplus::bus::new_default();
10
Adriana Kobylak70bb6bc2017-02-21 19:51:52 -060011 // Add sdbusplus ObjectManager for the 'root' path of the logging manager.
12 sdbusplus::server::manager::manager objManager(bus, OBJ_LOGGING);
Adriana Kobylakf477fe22017-01-06 11:56:41 -060013
Nagaraju Goruganti05aae8b2017-08-30 07:56:12 -050014 phosphor::logging::internal::Manager iMgr(bus, OBJ_INTERNAL);
15
16 phosphor::logging::Manager mgr(bus, OBJ_LOGGING, iMgr);
Adriana Kobylakf477fe22017-01-06 11:56:41 -060017
Deepak Kodihalli72654f12017-06-12 04:33:29 -050018 // 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 Goruganti05aae8b2017-08-30 07:56:12 -050022 iMgr.restore();
Deepak Kodihalli72654f12017-06-12 04:33:29 -050023
Adriana Kobylakf477fe22017-01-06 11:56:41 -060024 bus.request_name(BUSNAME_LOGGING);
25
Adriana Kobylakf477fe22017-01-06 11:56:41 -060026 while(true)
27 {
28 bus.process_discard();
29 bus.wait();
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060030 }
Adriana Kobylakf477fe22017-01-06 11:56:41 -060031
32 return 0;
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060033}