diff options
author | Matthias Maennich <maennich@google.com> | 2021-11-09 17:33:04 +0000 |
---|---|---|
committer | Matthias Maennich <maennich@google.com> | 2021-11-09 23:05:46 +0000 |
commit | ec99ad38f8b255a7d058c87767f99410e93ceb3d (patch) | |
tree | ed56c4f38f498a127cadbe4f6b99419119da7886 | |
parent | 1fc9bcaac9e4215a30d1e28adb0309ca421ea07f (diff) | |
download | build-tools-ec99ad38f8b255a7d058c87767f99410e93ceb3d.tar.gz |
Interceptor: log inputs/outputs as well
Bug: 205577427
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: Ie6b123d97c10a6a1931c8888d85fe63a68aa72e8
-rw-r--r-- | interceptor/interceptor.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/interceptor/interceptor.cc b/interceptor/interceptor.cc index dcf7aca..801b8ec 100644 --- a/interceptor/interceptor.cc +++ b/interceptor/interceptor.cc @@ -110,6 +110,20 @@ static std::string escape(std::string in) { return in; } +template <typename T> +static void dump_vector(std::ostream& os, const char* key, const std::vector<T>& vec) { + os << std::quoted(key) << ": ["; + bool comma = false; + for (const auto& e : vec) { + if (comma) { + os << ", "; + } + os << std::quoted(e); + comma = true; + } + os << "]"; +} + std::string Command::repr() const { std::ostringstream os; os << R"({"cmd": )"; @@ -122,6 +136,11 @@ std::string Command::repr() const { os << std::quoted(cmd.str()); } + os << ", "; + dump_vector(os, "in", inputs()); + os << ", "; + dump_vector(os, "out", outputs()); + os << R"(, "cwd": )" << std::quoted(cwd_); os << "}"; |