blob: 29791b2e839b393c0cfcaf3aa18fff0a9ef9532c [file] [log] [blame]
Deepak Kodihalli72654f12017-06-12 04:33:29 -05001#pragma once
2
Patrick Venturef18bf832018-10-26 18:14:00 -07003#include "config.h"
4
5#include "elog_entry.hpp"
Patrick Williamsfa2d9622024-09-30 16:25:43 -04006#include "paths.hpp"
Patrick Venturef18bf832018-10-26 18:14:00 -07007
Patrick Williams331c4852021-04-16 15:38:59 -05008#include <filesystem>
Deepak Kodihalli72654f12017-06-12 04:33:29 -05009#include <string>
10#include <vector>
Deepak Kodihalli72654f12017-06-12 04:33:29 -050011
12namespace phosphor
13{
14namespace logging
15{
16
Patrick Williams331c4852021-04-16 15:38:59 -050017namespace fs = std::filesystem;
Deepak Kodihalli72654f12017-06-12 04:33:29 -050018
Deepak Kodihalli72654f12017-06-12 04:33:29 -050019/** @brief Serialize and persist error d-bus object
20 * @param[in] a - const reference to error entry.
21 * @param[in] dir - pathname of directory where the serialized error will
22 * be placed.
23 * @return fs::path - pathname of persisted error file
24 */
25fs::path serialize(const Entry& e,
Patrick Williamsfa2d9622024-09-30 16:25:43 -040026 const fs::path& dir = fs::path(paths::error()));
Deepak Kodihalli72654f12017-06-12 04:33:29 -050027
28/** @brief Deserialze a persisted error into a d-bus object
29 * @param[in] path - pathname of persisted error file
30 * @param[in] e - reference to error object which is the target of
31 * deserialization.
32 * @return bool - true if the deserialization was successful, false otherwise.
33 */
34bool deserialize(const fs::path& path, Entry& e);
35
Matt Spinlerfb978da2022-01-21 08:42:24 -060036/** @brief Return the path to serialize a log entry to
37 * @param[in] id - log entry ID
38 * @param[in] dir - pathname of directory where the serialized error will
39 * be placed.
40 * @return fs::path - pathname of persisted error file
41 */
Patrick Williamsfa2d9622024-09-30 16:25:43 -040042fs::path getEntrySerializePath(uint32_t id,
43 const fs::path& dir = fs::path(paths::error()));
Matt Spinlerfb978da2022-01-21 08:42:24 -060044
Deepak Kodihalli72654f12017-06-12 04:33:29 -050045} // namespace logging
46} // namespace phosphor