log-manager: enable non-standard path for local tests
Enable the log-manager to be launched with a path other than
`/var/phosphor-logging` to allow it to be ran on a development system
for test purposes. This required some refactoring throughout as to
how paths were handled.
Tested:
After running tests, `/tmp/phosphor-logging` is populated with
entries. Launching `./builddir/phosphor-log-manager
/tmp/phosphor-logging`, the log-manager will have the entries on
dbus:
```
$ busctl --user tree xyz.openbmc_project.Logging
└─ /xyz
└─ /xyz/openbmc_project
└─ /xyz/openbmc_project/logging
├─ /xyz/openbmc_project/logging/entry
│ ├─ /xyz/openbmc_project/logging/entry/100
│ ├─ /xyz/openbmc_project/logging/entry/101
│ ├─ /xyz/openbmc_project/logging/entry/102
│ ├─ /xyz/openbmc_project/logging/entry/103
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I84968edeed0dcf73aaf8bb653060b6d3400b9b7b
diff --git a/elog_serialize.hpp b/elog_serialize.hpp
index 38ff424..29791b2 100644
--- a/elog_serialize.hpp
+++ b/elog_serialize.hpp
@@ -3,6 +3,7 @@
#include "config.h"
#include "elog_entry.hpp"
+#include "paths.hpp"
#include <filesystem>
#include <string>
@@ -22,7 +23,7 @@
* @return fs::path - pathname of persisted error file
*/
fs::path serialize(const Entry& e,
- const fs::path& dir = fs::path(ERRLOG_PERSIST_PATH));
+ const fs::path& dir = fs::path(paths::error()));
/** @brief Deserialze a persisted error into a d-bus object
* @param[in] path - pathname of persisted error file
@@ -38,8 +39,8 @@
* be placed.
* @return fs::path - pathname of persisted error file
*/
-fs::path getEntrySerializePath(
- uint32_t id, const fs::path& dir = fs::path(ERRLOG_PERSIST_PATH));
+fs::path getEntrySerializePath(uint32_t id,
+ const fs::path& dir = fs::path(paths::error()));
} // namespace logging
} // namespace phosphor