Injectable logging

Allows passing a Loggable to PCFactory.initializationOptions, which
is then injected to Logging.java and logging.h. Future log messages
in both Java and native will then be passed to this Loggable.

Bug: webrtc:9225
Change-Id: I2ff693380639448301a78a93dc11d3a0106f0967
Reviewed-on: https://webrtc-review.googlesource.com/73243
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23241}
This commit is contained in:
Paulina Hensman
2018-05-15 13:41:06 +02:00
committed by Commit Bot
parent 8694f29b30
commit 59216ec4a4
16 changed files with 390 additions and 70 deletions

View File

@ -47,6 +47,9 @@ class LogMessageForTesting : public LogMessage {
const std::string& get_extra() const { return extra_; }
bool is_noop() const { return is_noop_; }
#if defined(WEBRTC_ANDROID)
const char* get_tag() const { return tag_; }
#endif
// Returns the contents of the internal log stream.
// Note that parts of the stream won't (as is) be available until *after* the
@ -186,7 +189,13 @@ TEST(LogTest, CheckFilePathParsed) {
log_msg.stream() << "<- Does this look right?";
const std::string stream = log_msg.GetPrintStream();
#if defined(WEBRTC_ANDROID)
const char* tag = log_msg.get_tag();
EXPECT_NE(nullptr, strstr(tag, "myfile.cc"));
EXPECT_NE(std::string::npos, stream.find("100"));
#else
EXPECT_NE(std::string::npos, stream.find("(myfile.cc:100)"));
#endif
}
TEST(LogTest, CheckNoopLogEntry) {