Strip data contents out in logfile_utils prints under VLOG(2)
This helps us enormously in keeping the log volume down when there are
large messages in a log file. The contents are hard to read and not
likely interesting.
Change-Id: I8ee4265a1dd156b2c577db6a4c5f92e43dbcd235
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 9c7fe5d..260e368 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -528,7 +528,16 @@
const monotonic_clock::time_point timestamp = result->monotonic_sent_time;
newest_timestamp_ = std::max(newest_timestamp_, timestamp);
- VLOG(2) << "Read from " << filename() << " data " << FlatbufferToJson(msg);
+
+ if (VLOG_IS_ON(3)) {
+ VLOG(3) << "Read from " << filename() << " data " << FlatbufferToJson(msg);
+ } else if (VLOG_IS_ON(2)) {
+ SizePrefixedFlatbufferVector<MessageHeader> msg_copy = msg;
+ msg_copy.mutable_message()->clear_data();
+ VLOG(2) << "Read from " << filename() << " data "
+ << FlatbufferToJson(msg_copy);
+ }
+
return result;
}