1 #pragma once 2 3 #include "config.h" 4 5 #include "elog_entry.hpp" 6 #include "paths.hpp" 7 8 #include <filesystem> 9 10 namespace phosphor 11 { 12 namespace logging 13 { 14 15 namespace fs = std::filesystem; 16 17 /** @brief Serialize and persist error d-bus object 18 * @param[in] a - const reference to error entry. 19 * @param[in] dir - pathname of directory where the serialized error will 20 * be placed. 21 * @return fs::path - pathname of persisted error file 22 */ 23 fs::path serialize(const Entry& e, 24 const fs::path& dir = fs::path(paths::error())); 25 26 /** @brief Deserialze a persisted error into a d-bus object 27 * @param[in] path - pathname of persisted error file 28 * @param[in] e - reference to error object which is the target of 29 * deserialization. 30 * @return bool - true if the deserialization was successful, false otherwise. 31 */ 32 bool deserialize(const fs::path& path, Entry& e); 33 34 /** @brief Return the path to serialize a log entry to 35 * @param[in] id - log entry ID 36 * @param[in] dir - pathname of directory where the serialized error will 37 * be placed. 38 * @return fs::path - pathname of persisted error file 39 */ 40 fs::path getEntrySerializePath(uint32_t id, 41 const fs::path& dir = fs::path(paths::error())); 42 43 } // namespace logging 44 } // namespace phosphor 45