1 #pragma once 2 3 #include <map> 4 #include <optional> 5 #include <string> 6 #include <vector> 7 8 namespace phosphor::logging::util 9 { 10 11 /** 12 * @brief Return a value found in the /etc/os-release file 13 * 14 * @param[in] key - The key name, like "VERSION" 15 * 16 * @return std::optional<std::string> - The value 17 */ 18 std::optional<std::string> getOSReleaseValue(const std::string& key); 19 20 /** 21 * @brief Synchronize unwritten journal messages to disk. 22 * @details This is the same implementation as the systemd command 23 * "journalctl --sync". 24 */ 25 void journalSync(); 26 27 namespace additional_data 28 { 29 /** @brief Pull out metadata name and value from the string 30 * <metadata name>=<metadata value> 31 * @param [in] data - metadata key=value entries 32 * @return map of metadata name:value 33 */ 34 auto parse(const std::vector<std::string>& data) 35 -> std::map<std::string, std::string>; 36 /** @brief Combine the metadata keys and values from the map 37 * into a vector of strings that look like: 38 * "<metadata name>=<metadata value>" 39 * @param [in] data - metadata key:value map 40 * @return vector of "key=value" strings 41 */ 42 auto combine(const std::map<std::string, std::string>& data) 43 -> std::vector<std::string>; 44 } // namespace additional_data 45 46 } // namespace phosphor::logging::util 47