1 #pragma once 2 3 #include <nlohmann/json.hpp> 4 5 #include <map> 6 #include <string> 7 #include <vector> 8 9 /** @brief Stores the error to log if errors to monitor is found */ 10 struct targetEntry 11 { 12 std::string errorToLog; 13 std::vector<std::string> errorsToMonitor; 14 }; 15 16 /** @brief A map of the systemd target to its corresponding targetEntry*/ 17 using TargetErrorData = std::map<std::string, targetEntry>; 18 19 using json = nlohmann::json; 20 21 extern bool gVerbose; 22 23 /** @brief Parse input json files 24 * 25 * Will return the parsed data in the TargetErrorData object 26 * 27 * @note This function will throw exceptions for an invalid json file 28 * @note See phosphor-target-monitor-default.json for example of json file 29 * format 30 * 31 * @param[in] filePaths - The file(s) to parse 32 * 33 * @return Map of target to error log relationships 34 */ 35 TargetErrorData parseFiles(const std::vector<std::string>& filePaths); 36