diff options
author | Björn Terelius <terelius@webrtc.org> | 2019-11-01 14:31:46 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-04 12:42:57 +0000 |
commit | a06048a41ed1088b490671007c151b68f483eeef (patch) | |
tree | 35dee84160fc9236d4f5d190891e92e5a73712b3 /rtc_tools | |
parent | cc9bf6398c0348395442875cec6d14092a1959f7 (diff) | |
download | webrtc-a06048a41ed1088b490671007c151b68f483eeef.tar.gz |
Return status instead of CHECKing in event log parser.
This CL adds ParseStatus/ParseStatusOr classes and returns those instead
of CHECKing that the log is well formed. Some refactoring was required.
We also add a allow_incomplete_logs parameter to the parser which by
default is false. Setting it to true will make the parser log a warning
but return success for errors that typically indicate that the log has
been truncated. "Deeper" errors indicating log corruption still return
an error.
Bug: webrtc:11064
Change-Id: Id5bd6e321de07e250662ae3aaa5ef15f48db6d55
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158746
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29679}
Diffstat (limited to 'rtc_tools')
-rw-r--r-- | rtc_tools/rtc_event_log_visualizer/main.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc index cd2f8bbd65..cac0cb3fa0 100644 --- a/rtc_tools/rtc_event_log_visualizer/main.cc +++ b/rtc_tools/rtc_event_log_visualizer/main.cc @@ -29,6 +29,7 @@ #include "logging/rtc_event_log/rtc_event_log_parser.h" #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h" #include "rtc_base/checks.h" +#include "rtc_base/logging.h" #include "rtc_tools/rtc_event_log_visualizer/analyzer.h" #include "rtc_tools/rtc_event_log_visualizer/plot_base.h" #include "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h" @@ -198,6 +199,12 @@ int main(int argc, char* argv[]) { absl::SetFlagsUsageConfig(config); std::vector<char*> args = absl::ParseCommandLine(argc, argv); + // Print RTC_LOG warnings and errors even in release builds. + if (rtc::LogMessage::GetLogToDebug() > rtc::LS_WARNING) { + rtc::LogMessage::LogToDebug(rtc::LS_WARNING); + } + rtc::LogMessage::SetLogToStderr(true); + // Flag replacements std::map<std::string, std::vector<std::string>> flag_aliases = { {"default", @@ -241,13 +248,16 @@ int main(int argc, char* argv[]) { header_extensions = webrtc::ParsedRtcEventLog:: UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig; } - webrtc::ParsedRtcEventLog parsed_log(header_extensions); + webrtc::ParsedRtcEventLog parsed_log(header_extensions, + /*allow_incomplete_logs*/ true); if (args.size() == 2) { std::string filename = args[1]; - if (!parsed_log.ParseFile(filename)) { - std::cerr << "Could not parse the entire log file." << std::endl; - std::cerr << "Only the parsable events will be analyzed." << std::endl; + auto status = parsed_log.ParseFile(filename); + if (!status.ok()) { + std::cerr << "Failed to parse " << filename << ": " << status.message() + << std::endl; + return -1; } } |