From 9aa39484c4f32e9278a59ba89233ba9b59a9dd64 Mon Sep 17 00:00:00 2001 From: Bradley White <14679271+devbww@users.noreply.github.com> Date: Thu, 14 Jul 2022 13:25:45 -0400 Subject: [PATCH] feat(common): make the RPC log even more readable (#9477) - Expand google.protobuf.Any payloads rather than printing their serialized content. - Print fields in the order defined in source code instead of by the field number. --- google/cloud/internal/log_wrapper.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/google/cloud/internal/log_wrapper.cc b/google/cloud/internal/log_wrapper.cc index 176dd2fcc039..14b8403d7bb3 100644 --- a/google/cloud/internal/log_wrapper.cc +++ b/google/cloud/internal/log_wrapper.cc @@ -34,6 +34,8 @@ std::string DebugString(google::protobuf::Message const& m, p.SetUseShortRepeatedPrimitives(options.use_short_repeated_primitives()); p.SetTruncateStringFieldLongerThan( options.truncate_string_field_longer_than()); + p.SetPrintMessageFieldsInIndexOrder(true); + p.SetExpandAny(true); p.PrintToString(m, &str); return absl::StrCat(m.GetTypeName(), " {", (options.single_line_mode() ? " " : "\n"), str, "}");