加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
systemd_target_parser.hpp 893 Bytes
一键复制 编辑 原始数据 按行查看 历史
#pragma once
#include <nlohmann/json.hpp>
#include <map>
#include <string>
#include <vector>
/** @brief Stores the error to log if errors to monitor is found */
struct targetEntry
{
std::string errorToLog;
std::vector<std::string> errorsToMonitor;
};
/** @brief A map of the systemd target to its corresponding targetEntry*/
using TargetErrorData = std::map<std::string, targetEntry>;
using json = nlohmann::json;
extern bool gVerbose;
/** @brief Parse input json files
*
* Will return the parsed data in the TargetErrorData object
*
* @note This function will throw exceptions for an invalid json file
* @note See phosphor-target-monitor-default.json for example of json file
* format
*
* @param[in] filePaths - The file(s) to parse
*
* @return Map of target to error log relationships
*/
TargetErrorData parseFiles(const std::vector<std::string>& filePaths);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化