blob: 710efa1c2e05101f70fe9aa9460f1daab20fc938 [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
10namespace phosphor
11{
12namespace logging
13{
14
Patrick Williams331c4852021-04-16 15:38:59 -050015namespace fs = std::filesystem;
Deepak Kodihalli72654f12017-06-12 04:33:29 -050016
Deepak Kodihalli72654f12017-06-12 04:33:29 -050017/** @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 */
23fs::path serialize(const Entry& e,
Patrick Williamsfa2d9622024-09-30 16:25:43 -040024 const fs::path& dir = fs::path(paths::error()));
Deepak Kodihalli72654f12017-06-12 04:33:29 -050025
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 */
32bool deserialize(const fs::path& path, Entry& e);
33
Matt Spinlerfb978da2022-01-21 08:42:24 -060034/** @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 */
Patrick Williamsfa2d9622024-09-30 16:25:43 -040040fs::path getEntrySerializePath(uint32_t id,
41 const fs::path& dir = fs::path(paths::error()));
Matt Spinlerfb978da2022-01-21 08:42:24 -060042
Deepak Kodihalli72654f12017-06-12 04:33:29 -050043} // namespace logging
44} // namespace phosphor