| 139 | using GetField = std::function<spanner::Value(gcs::ObjectMetadata const&)>; |
| 140 | |
| 141 | void ThrowIfNotOkay(std::string const& context, |
| 142 | google::cloud::Status const& status) { |
| 143 | if (status.ok()) return; |
| 144 | std::ostringstream os; |
| 145 | os << "error while " << context << " status=" << status; |
| 146 | throw std::runtime_error(std::move(os).str()); |
| 147 | } |
| 148 | |
| 149 | std::string LogFormat(std::string const& sev, std::string const& msg) { |
| 150 | return nlohmann::json{{"severity", sev}, {"message", msg}}.dump(); |