| 53 | } |
| 54 | |
| 55 | void ThrowIfNotOkay(std::string const& context, |
| 56 | google::cloud::Status const& status) { |
| 57 | if (status.ok()) return; |
| 58 | std::ostringstream os; |
| 59 | os << "error while " << context << " status=" << status; |
| 60 | throw std::runtime_error(std::move(os).str()); |
| 61 | } |
| 62 | |
| 63 | nlohmann::json LogFormat(std::string const& sev, std::string const& msg) { |
| 64 | return nlohmann::json{{"severity", sev}, {"message", msg}}.dump(); |