Stop using LOG macros in favor of RTC_ prefixed macros.
This CL has been generated with the following script:
for m in PLOG \
LOG_TAG \
LOG_GLEM \
LOG_GLE_EX \
LOG_GLE \
LAST_SYSTEM_ERROR \
LOG_ERRNO_EX \
LOG_ERRNO \
LOG_ERR_EX \
LOG_ERR \
LOG_V \
LOG_F \
LOG_T_F \
LOG_E \
LOG_T \
LOG_CHECK_LEVEL_V \
LOG_CHECK_LEVEL \
LOG
do
git grep -l $m | xargs sed -i "s,\b$m\b,RTC_$m,g"
done
git checkout rtc_base/logging.h
git cl format
Bug: webrtc:8452
Change-Id: I1a53ef3e0a5ef6e244e62b2e012b864914784600
Reviewed-on: https://webrtc-review.googlesource.com/21325
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20617}
diff --git a/rtc_base/asyncinvoker.cc b/rtc_base/asyncinvoker.cc
index 048fbb0..7f65dfc 100644
--- a/rtc_base/asyncinvoker.cc
+++ b/rtc_base/asyncinvoker.cc
@@ -76,7 +76,7 @@
// tasks that AsyncInvoke other tasks. But otherwise it indicates a race
// between a thread destroying the AsyncInvoker and a thread still trying
// to use it.
- LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
+ RTC_LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
return;
}
thread->Post(posted_from, this, id,
@@ -90,7 +90,7 @@
uint32_t id) {
if (destroying_.load(std::memory_order_relaxed)) {
// See above comment.
- LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
+ RTC_LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
return;
}
thread->PostDelayed(posted_from, delay_ms, this, id,
diff --git a/rtc_base/asynctcpsocket.cc b/rtc_base/asynctcpsocket.cc
index d3d88bc..9e0589c 100644
--- a/rtc_base/asynctcpsocket.cc
+++ b/rtc_base/asynctcpsocket.cc
@@ -46,11 +46,11 @@
const rtc::SocketAddress& remote_address) {
std::unique_ptr<rtc::AsyncSocket> owned_socket(socket);
if (socket->Bind(bind_address) < 0) {
- LOG(LS_ERROR) << "Bind() failed with error " << socket->GetError();
+ RTC_LOG(LS_ERROR) << "Bind() failed with error " << socket->GetError();
return nullptr;
}
if (socket->Connect(remote_address) < 0) {
- LOG(LS_ERROR) << "Connect() failed with error " << socket->GetError();
+ RTC_LOG(LS_ERROR) << "Connect() failed with error " << socket->GetError();
return nullptr;
}
return owned_socket.release();
@@ -76,7 +76,7 @@
if (listen_) {
if (socket_->Listen(kListenBacklog) < 0) {
- LOG(LS_ERROR) << "Listen() failed with error " << socket_->GetError();
+ RTC_LOG(LS_ERROR) << "Listen() failed with error " << socket_->GetError();
}
}
}
@@ -190,7 +190,8 @@
if (!new_socket) {
// TODO(stefan): Do something better like forwarding the error
// to the user.
- LOG(LS_ERROR) << "TCP accept failed with error " << socket_->GetError();
+ RTC_LOG(LS_ERROR) << "TCP accept failed with error "
+ << socket_->GetError();
return;
}
@@ -213,7 +214,7 @@
// TODO(stefan): Do something better like forwarding the error to the
// user.
if (!socket_->IsBlocking()) {
- LOG(LS_ERROR) << "Recv() returned error: " << socket_->GetError();
+ RTC_LOG(LS_ERROR) << "Recv() returned error: " << socket_->GetError();
}
break;
}
@@ -233,7 +234,7 @@
ProcessInput(inbuf_.data<char>(), &size);
if (size > inbuf_.size()) {
- LOG(LS_ERROR) << "input buffer overflow";
+ RTC_LOG(LS_ERROR) << "input buffer overflow";
RTC_NOTREACHED();
inbuf_.Clear();
} else {
diff --git a/rtc_base/asyncudpsocket.cc b/rtc_base/asyncudpsocket.cc
index 64bc8b1..0896e50 100644
--- a/rtc_base/asyncudpsocket.cc
+++ b/rtc_base/asyncudpsocket.cc
@@ -21,7 +21,7 @@
const SocketAddress& bind_address) {
std::unique_ptr<AsyncSocket> owned_socket(socket);
if (socket->Bind(bind_address) < 0) {
- LOG(LS_ERROR) << "Bind() failed with error " << socket->GetError();
+ RTC_LOG(LS_ERROR) << "Bind() failed with error " << socket->GetError();
return nullptr;
}
return new AsyncUDPSocket(owned_socket.release());
@@ -111,8 +111,9 @@
// When doing ICE, this kind of thing will often happen.
// TODO: Do something better like forwarding the error to the user.
SocketAddress local_addr = socket_->GetLocalAddress();
- LOG(LS_INFO) << "AsyncUDPSocket[" << local_addr.ToSensitiveString() << "] "
- << "receive failed with error " << socket_->GetError();
+ RTC_LOG(LS_INFO) << "AsyncUDPSocket[" << local_addr.ToSensitiveString()
+ << "] "
+ << "receive failed with error " << socket_->GetError();
return;
}
diff --git a/rtc_base/base64_unittest.cc b/rtc_base/base64_unittest.cc
index 0cb26c3..0f7c80d 100644
--- a/rtc_base/base64_unittest.cc
+++ b/rtc_base/base64_unittest.cc
@@ -320,13 +320,13 @@
// Only added because string.compare() in gcc-3.3.3 seems to misbehave with
// embedded nulls.
// TODO: switch back to string.compare() if/when gcc is fixed
-#define EXPECT_EQ_ARRAY(len, x, y, msg) \
+#define EXPECT_EQ_ARRAY(len, x, y, msg) \
for (size_t j = 0; j < len; ++j) { \
- if (x[j] != y[j]) { \
- LOG(LS_ERROR) << "" # x << " != " # y \
- << " byte " << j << " msg: " << msg; \
- } \
- }
+ if (x[j] != y[j]) { \
+ RTC_LOG(LS_ERROR) << "" #x << " != " #y << " byte " << j \
+ << " msg: " << msg; \
+ } \
+ }
size_t Base64Escape(const unsigned char *src, size_t szsrc, char *dest,
size_t szdest) {
@@ -351,7 +351,7 @@
}
TEST(Base64, EncodeDecodeBattery) {
- LOG(LS_VERBOSE) << "Testing base-64";
+ RTC_LOG(LS_VERBOSE) << "Testing base-64";
size_t i;
@@ -363,7 +363,7 @@
size_t decode_length;
size_t cypher_length;
- LOG(LS_VERBOSE) << "B64: " << base64_tests[i].cyphertext;
+ RTC_LOG(LS_VERBOSE) << "B64: " << base64_tests[i].cyphertext;
const unsigned char* unsigned_plaintext =
reinterpret_cast<const unsigned char*>(base64_tests[i].plaintext);
@@ -896,7 +896,7 @@
static std::string gCommandLine;
TEST(Base64, LargeSample) {
- LOG(LS_VERBOSE) << "Testing specific base64 file";
+ RTC_LOG(LS_VERBOSE) << "Testing specific base64 file";
char unescaped[64 * 1024];
diff --git a/rtc_base/checks.cc b/rtc_base/checks.cc
index 8f452e8..fc5c789 100644
--- a/rtc_base/checks.cc
+++ b/rtc_base/checks.cc
@@ -111,10 +111,11 @@
}
void FatalMessage::Init(const char* file, int line) {
- stream_ << std::endl << std::endl
+ stream_ << std::endl
+ << std::endl
<< "#" << std::endl
<< "# Fatal error in " << file << ", line " << line << std::endl
- << "# last system error: " << LAST_SYSTEM_ERROR << std::endl
+ << "# last system error: " << RTC_LAST_SYSTEM_ERROR << std::endl
<< "# ";
}
diff --git a/rtc_base/cpu_time.cc b/rtc_base/cpu_time.cc
index 3819e52..6c22880 100644
--- a/rtc_base/cpu_time.cc
+++ b/rtc_base/cpu_time.cc
@@ -41,7 +41,7 @@
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) == 0) {
return ts.tv_sec * kNumNanosecsPerSec + ts.tv_nsec;
} else {
- LOG_ERR(LS_ERROR) << "clock_gettime() failed.";
+ RTC_LOG_ERR(LS_ERROR) << "clock_gettime() failed.";
}
#elif defined(WEBRTC_MAC)
struct rusage rusage;
@@ -49,7 +49,7 @@
return rusage.ru_utime.tv_sec * kNumNanosecsPerSec +
rusage.ru_utime.tv_usec * kNumNanosecsPerMicrosec;
} else {
- LOG_ERR(LS_ERROR) << "getrusage() failed.";
+ RTC_LOG_ERR(LS_ERROR) << "getrusage() failed.";
}
#elif defined(WEBRTC_WIN)
FILETIME createTime;
@@ -62,7 +62,7 @@
userTime.dwLowDateTime) *
kNanosecsPerFiletime;
} else {
- LOG_ERR(LS_ERROR) << "GetProcessTimes() failed.";
+ RTC_LOG_ERR(LS_ERROR) << "GetProcessTimes() failed.";
}
#else
// Not implemented yet.
@@ -78,7 +78,7 @@
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) == 0) {
return ts.tv_sec * kNumNanosecsPerSec + ts.tv_nsec;
} else {
- LOG_ERR(LS_ERROR) << "clock_gettime() failed.";
+ RTC_LOG_ERR(LS_ERROR) << "clock_gettime() failed.";
}
#elif defined(WEBRTC_MAC)
thread_basic_info_data_t info;
@@ -88,7 +88,7 @@
return info.user_time.seconds * kNumNanosecsPerSec +
info.user_time.microseconds * kNumNanosecsPerMicrosec;
} else {
- LOG_ERR(LS_ERROR) << "thread_info() failed.";
+ RTC_LOG_ERR(LS_ERROR) << "thread_info() failed.";
}
#elif defined(WEBRTC_WIN)
FILETIME createTime;
@@ -101,7 +101,7 @@
userTime.dwLowDateTime) *
kNanosecsPerFiletime;
} else {
- LOG_ERR(LS_ERROR) << "GetThreadTimes() failed.";
+ RTC_LOG_ERR(LS_ERROR) << "GetThreadTimes() failed.";
}
#else
// Not implemented yet.
diff --git a/rtc_base/event_tracer.cc b/rtc_base/event_tracer.cc
index 1b79786..9cbda97 100644
--- a/rtc_base/event_tracer.cc
+++ b/rtc_base/event_tracer.cc
@@ -385,8 +385,8 @@
FILE* file = fopen(filename, "w");
if (!file) {
- LOG(LS_ERROR) << "Failed to open trace file '" << filename
- << "' for writing.";
+ RTC_LOG(LS_ERROR) << "Failed to open trace file '" << filename
+ << "' for writing.";
return false;
}
g_event_logger->Start(file, true);
diff --git a/rtc_base/filerotatingstream.cc b/rtc_base/filerotatingstream.cc
index 3856155..4e3aa73 100644
--- a/rtc_base/filerotatingstream.cc
+++ b/rtc_base/filerotatingstream.cc
@@ -115,8 +115,9 @@
StreamResult result = file_stream_->Read(buffer, buffer_len, read, error);
if (result == SR_EOS || result == SR_ERROR) {
if (result == SR_ERROR) {
- LOG(LS_ERROR) << "Failed to read from: "
- << file_names_[current_file_index_] << "Error: " << error;
+ RTC_LOG(LS_ERROR) << "Failed to read from: "
+ << file_names_[current_file_index_]
+ << "Error: " << error;
}
// Reached the end of the file, read next file. If there is an error return
// the error status but allow for a next read by reading next file.
diff --git a/rtc_base/firewallsocketserver.cc b/rtc_base/firewallsocketserver.cc
index a8b0839..60f45ed 100644
--- a/rtc_base/firewallsocketserver.cc
+++ b/rtc_base/firewallsocketserver.cc
@@ -35,9 +35,9 @@
int Connect(const SocketAddress& addr) override {
if (type_ == SOCK_STREAM) {
if (!server_->Check(FP_TCP, GetLocalAddress(), addr)) {
- LOG(LS_VERBOSE) << "FirewallSocket outbound TCP connection from "
- << GetLocalAddress().ToSensitiveString() << " to "
- << addr.ToSensitiveString() << " denied";
+ RTC_LOG(LS_VERBOSE) << "FirewallSocket outbound TCP connection from "
+ << GetLocalAddress().ToSensitiveString() << " to "
+ << addr.ToSensitiveString() << " denied";
// TODO: Handle this asynchronously.
SetError(EHOSTUNREACH);
return SOCKET_ERROR;
@@ -52,9 +52,10 @@
RTC_DCHECK(type_ == SOCK_DGRAM || type_ == SOCK_STREAM);
FirewallProtocol protocol = (type_ == SOCK_DGRAM) ? FP_UDP : FP_TCP;
if (!server_->Check(protocol, GetLocalAddress(), addr)) {
- LOG(LS_VERBOSE) << "FirewallSocket outbound packet with type " << type_
- << " from " << GetLocalAddress().ToSensitiveString()
- << " to " << addr.ToSensitiveString() << " dropped";
+ RTC_LOG(LS_VERBOSE) << "FirewallSocket outbound packet with type "
+ << type_ << " from "
+ << GetLocalAddress().ToSensitiveString() << " to "
+ << addr.ToSensitiveString() << " dropped";
return static_cast<int>(cb);
}
return AsyncSocketAdapter::SendTo(pv, cb, addr);
@@ -74,9 +75,10 @@
return res;
if (server_->Check(FP_UDP, *paddr, GetLocalAddress()))
return res;
- LOG(LS_VERBOSE) << "FirewallSocket inbound UDP packet from "
- << paddr->ToSensitiveString() << " to "
- << GetLocalAddress().ToSensitiveString() << " dropped";
+ RTC_LOG(LS_VERBOSE)
+ << "FirewallSocket inbound UDP packet from "
+ << paddr->ToSensitiveString() << " to "
+ << GetLocalAddress().ToSensitiveString() << " dropped";
}
}
return AsyncSocketAdapter::RecvFrom(pv, cb, paddr, timestamp);
@@ -84,7 +86,7 @@
int Listen(int backlog) override {
if (!server_->tcp_listen_enabled()) {
- LOG(LS_VERBOSE) << "FirewallSocket listen attempt denied";
+ RTC_LOG(LS_VERBOSE) << "FirewallSocket listen attempt denied";
return -1;
}
@@ -100,9 +102,9 @@
}
sock->Close();
delete sock;
- LOG(LS_VERBOSE) << "FirewallSocket inbound TCP connection from "
- << addr.ToSensitiveString() << " to "
- << GetLocalAddress().ToSensitiveString() << " denied";
+ RTC_LOG(LS_VERBOSE) << "FirewallSocket inbound TCP connection from "
+ << addr.ToSensitiveString() << " to "
+ << GetLocalAddress().ToSensitiveString() << " denied";
}
return 0;
}
@@ -226,7 +228,7 @@
if (!sock ||
(type == SOCK_STREAM && !tcp_sockets_enabled_) ||
(type == SOCK_DGRAM && !udp_sockets_enabled_)) {
- LOG(LS_VERBOSE) << "FirewallSocketServer socket creation denied";
+ RTC_LOG(LS_VERBOSE) << "FirewallSocketServer socket creation denied";
delete sock;
return nullptr;
}
diff --git a/rtc_base/gunit.h b/rtc_base/gunit.h
index 333e85a..9ee3c72 100644
--- a/rtc_base/gunit.h
+++ b/rtc_base/gunit.h
@@ -83,19 +83,19 @@
// Version with a "soft" timeout and a margin. This logs if the timeout is
// exceeded, but it only fails if the expression still isn't true after the
// margin time passes.
-#define EXPECT_TRUE_WAIT_MARGIN(ex, timeout, margin) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (bool res = true) { \
- WAIT_(ex, timeout, res); \
- if (res) \
- break; \
- LOG(LS_WARNING) << "Expression " << #ex << " still not true after " \
- << (timeout) << "ms; waiting an additional " << margin \
- << "ms"; \
- WAIT_(ex, margin, res); \
- if (!res) \
- goto GTEST_CONCAT_TOKEN_(gunit_label_, __LINE__); \
- } else \
+#define EXPECT_TRUE_WAIT_MARGIN(ex, timeout, margin) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (bool res = true) { \
+ WAIT_(ex, timeout, res); \
+ if (res) \
+ break; \
+ RTC_LOG(LS_WARNING) << "Expression " << #ex << " still not true after " \
+ << (timeout) << "ms; waiting an additional " << margin \
+ << "ms"; \
+ WAIT_(ex, margin, res); \
+ if (!res) \
+ goto GTEST_CONCAT_TOKEN_(gunit_label_, __LINE__); \
+ } else \
GTEST_CONCAT_TOKEN_(gunit_label_, __LINE__) : EXPECT_TRUE(ex)
// Wait until "ex" is true, or "timeout" expires, using fake clock where
diff --git a/rtc_base/helpers.cc b/rtc_base/helpers.cc
index e62aaf8..b0c8856 100644
--- a/rtc_base/helpers.cc
+++ b/rtc_base/helpers.cc
@@ -110,7 +110,7 @@
bool InitRandom(const char* seed, size_t len) {
if (!Rng().Init(seed, len)) {
- LOG(LS_ERROR) << "Failed to init random generator!";
+ RTC_LOG(LS_ERROR) << "Failed to init random generator!";
return false;
}
return true;
@@ -128,12 +128,12 @@
str->clear();
// Avoid biased modulo division below.
if (256 % table_size) {
- LOG(LS_ERROR) << "Table size must divide 256 evenly!";
+ RTC_LOG(LS_ERROR) << "Table size must divide 256 evenly!";
return false;
}
std::unique_ptr<uint8_t[]> bytes(new uint8_t[len]);
if (!Rng().Generate(bytes.get(), len)) {
- LOG(LS_ERROR) << "Failed to generate random string!";
+ RTC_LOG(LS_ERROR) << "Failed to generate random string!";
return false;
}
str->reserve(len);
diff --git a/rtc_base/httpbase.cc b/rtc_base/httpbase.cc
index 9c5d1be..d28d800 100644
--- a/rtc_base/httpbase.cc
+++ b/rtc_base/httpbase.cc
@@ -84,7 +84,7 @@
len -= 1;
}
ProcessResult result = ProcessLine(line, len, error);
- LOG(LS_VERBOSE) << "Processed line, result=" << result;
+ RTC_LOG(LS_VERBOSE) << "Processed line, result=" << result;
if (PR_CONTINUE != result) {
return result;
@@ -106,8 +106,8 @@
size_t read = 0;
ProcessResult result = ProcessData(buffer + *processed, available, read,
error);
- LOG(LS_VERBOSE) << "Processed data, result: " << result << " read: "
- << read << " err: " << error;
+ RTC_LOG(LS_VERBOSE) << "Processed data, result: " << result
+ << " read: " << read << " err: " << error;
if (PR_CONTINUE != result) {
return result;
@@ -124,9 +124,9 @@
HttpParser::ProcessResult
HttpParser::ProcessLine(const char* line, size_t len, HttpError* error) {
- LOG_F(LS_VERBOSE) << " state: " << state_ << " line: "
- << std::string(line, len) << " len: " << len << " err: "
- << error;
+ RTC_LOG_F(LS_VERBOSE) << " state: " << state_
+ << " line: " << std::string(line, len)
+ << " len: " << len << " err: " << error;
switch (state_) {
case ST_LEADER:
@@ -494,7 +494,7 @@
} else if (error == SEC_E_CERT_EXPIRED) {
return HE_CERTIFICATE_EXPIRED;
}
- LOG_F(LS_ERROR) << "(" << error << ")";
+ RTC_LOG_F(LS_ERROR) << "(" << error << ")";
return (HM_CONNECT == mode_) ? HE_CONNECT_FAILED : HE_SOCKET_ERROR;
}
@@ -576,7 +576,7 @@
}
} while (++loop_count <= kMaxReadCount);
- LOG_F(LS_WARNING) << "danger of starvation";
+ RTC_LOG_F(LS_WARNING) << "danger of starvation";
return false;
}
@@ -668,7 +668,7 @@
// to be flushed to the network.
send_required = true;
} else {
- LOG_F(LS_ERROR) << "Read error: " << error;
+ RTC_LOG_F(LS_ERROR) << "Read error: " << error;
do_complete(HE_STREAM);
return;
}
@@ -699,7 +699,7 @@
}
} else {
RTC_DCHECK(result == SR_ERROR);
- LOG_F(LS_ERROR) << "error";
+ RTC_LOG_F(LS_ERROR) << "error";
OnHttpStreamEvent(http_stream_, SE_CLOSE, error);
return;
}
@@ -720,7 +720,8 @@
len_ += len;
++header_;
} else if (len_ == 0) {
- LOG(WARNING) << "discarding header that is too long: " << header_->first;
+ RTC_LOG(WARNING) << "discarding header that is too long: "
+ << header_->first;
++header_;
} else {
// Not enough room for the next header, write to network first.
@@ -806,7 +807,7 @@
}
if (events & SE_CLOSE) {
- LOG_F(LS_ERROR) << "Read error: " << error;
+ RTC_LOG_F(LS_ERROR) << "Read error: " << error;
do_complete(HE_STREAM);
return;
}
@@ -866,12 +867,12 @@
case SR_BLOCK:
return PR_BLOCK;
case SR_EOS:
- LOG_F(LS_ERROR) << "Unexpected EOS";
+ RTC_LOG_F(LS_ERROR) << "Unexpected EOS";
*error = HE_STREAM;
return PR_COMPLETE;
case SR_ERROR:
default:
- LOG_F(LS_ERROR) << "Write error: " << write_error;
+ RTC_LOG_F(LS_ERROR) << "Write error: " << write_error;
*error = HE_STREAM;
return PR_COMPLETE;
}
@@ -879,7 +880,7 @@
void
HttpBase::OnComplete(HttpError err) {
- LOG_F(LS_VERBOSE);
+ RTC_LOG_F(LS_VERBOSE);
do_complete(err);
}
diff --git a/rtc_base/httpbase_unittest.cc b/rtc_base/httpbase_unittest.cc
index 4c92f9b..1b7ab7f 100644
--- a/rtc_base/httpbase_unittest.cc
+++ b/rtc_base/httpbase_unittest.cc
@@ -63,7 +63,7 @@
}
HttpError onHttpHeaderComplete(bool chunked, size_t& data_size) override {
- LOG_F(LS_VERBOSE) << "chunked: " << chunked << " size: " << data_size;
+ RTC_LOG_F(LS_VERBOSE) << "chunked: " << chunked << " size: " << data_size;
Event e = { E_HEADER_COMPLETE, chunked, data_size, HM_NONE, HE_NONE};
events.push_back(e);
if (obtain_stream) {
@@ -72,12 +72,12 @@
return HE_NONE;
}
void onHttpComplete(HttpMode mode, HttpError err) override {
- LOG_F(LS_VERBOSE) << "mode: " << mode << " err: " << err;
+ RTC_LOG_F(LS_VERBOSE) << "mode: " << mode << " err: " << err;
Event e = { E_COMPLETE, false, 0, mode, err };
events.push_back(e);
}
void onHttpClosed(HttpError err) override {
- LOG_F(LS_VERBOSE) << "err: " << err;
+ RTC_LOG_F(LS_VERBOSE) << "err: " << err;
Event e = { E_CLOSED, false, 0, HM_NONE, err };
events.push_back(e);
}
@@ -115,7 +115,7 @@
};
void HttpBaseTest::SetupSource(const char* http_data) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
src.SetState(SS_OPENING);
src.QueueString(http_data);
@@ -133,11 +133,11 @@
mem = new MemoryStream;
data.document.reset(mem);
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifyHeaderComplete(size_t event_count, bool empty_doc) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
ASSERT_EQ(event_count, events.size());
EXPECT_EQ(E_HEADER_COMPLETE, events[0].event);
@@ -165,12 +165,12 @@
EXPECT_TRUE(data.hasHeader(HH_TRANSFER_ENCODING, &header));
EXPECT_EQ("chunked", header);
}
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifyDocumentContents(const char* expected_data,
size_t expected_length) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
if (SIZE_UNKNOWN == expected_length) {
expected_length = strlen(expected_data);
@@ -181,20 +181,20 @@
mem->GetSize(&length);
EXPECT_EQ(expected_length, length);
EXPECT_TRUE(0 == memcmp(expected_data, mem->GetBuffer(), length));
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::ObtainDocumentStream() {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
EXPECT_FALSE(http_stream);
http_stream = base.GetDocumentStream();
ASSERT_TRUE(nullptr != http_stream);
sink.Monitor(http_stream);
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifyDocumentStreamIsOpening() {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
ASSERT_TRUE(nullptr != http_stream);
EXPECT_EQ(0, sink.Events(http_stream));
EXPECT_EQ(SS_OPENING, http_stream->GetState());
@@ -203,11 +203,11 @@
char buffer[5] = { 0 };
EXPECT_EQ(SR_BLOCK,
http_stream->Read(buffer, sizeof(buffer), &read, nullptr));
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifyDocumentStreamOpenEvent() {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
ASSERT_TRUE(nullptr != http_stream);
EXPECT_EQ(SE_OPEN | SE_READ, sink.Events(http_stream));
@@ -216,11 +216,11 @@
// HTTP headers haven't arrived yet
EXPECT_EQ(0U, events.size());
EXPECT_EQ(static_cast<uint32_t>(HC_INTERNAL_SERVER_ERROR), data.scode);
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::ReadDocumentStreamData(const char* expected_data) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
ASSERT_TRUE(nullptr != http_stream);
EXPECT_EQ(SS_OPEN, http_stream->GetState());
@@ -239,11 +239,11 @@
EXPECT_TRUE(0 == memcmp(expected_data + verified_length, buffer, read));
verified_length += read;
}
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifyDocumentStreamIsEOS() {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
ASSERT_TRUE(nullptr != http_stream);
size_t read = 0;
@@ -253,11 +253,11 @@
// When EOS is caused by Read, we don't expect SE_CLOSE
EXPECT_EQ(0, sink.Events(http_stream));
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::SetupDocument(const char* document_data) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
src.SetState(SS_OPEN);
base.notify(this);
@@ -277,30 +277,30 @@
data.scode = HC_OK;
data.setHeader(HH_PROXY_AUTHORIZATION, "42");
data.setHeader(HH_CONNECTION, "Keep-Alive");
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifySourceContents(const char* expected_data,
size_t expected_length) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
if (SIZE_UNKNOWN == expected_length) {
expected_length = strlen(expected_data);
}
std::string contents = src.ReadData();
EXPECT_EQ(expected_length, contents.length());
EXPECT_TRUE(0 == memcmp(expected_data, contents.data(), expected_length));
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
void HttpBaseTest::VerifyTransferComplete(HttpMode mode, HttpError error) {
- LOG_F(LS_VERBOSE) << "Enter";
+ RTC_LOG_F(LS_VERBOSE) << "Enter";
// Verify that http operation has completed
ASSERT_TRUE(events.size() > 0);
size_t last_event = events.size() - 1;
EXPECT_EQ(E_COMPLETE, events[last_event].event);
EXPECT_EQ(mode, events[last_event].mode);
EXPECT_EQ(error, events[last_event].err);
- LOG_F(LS_VERBOSE) << "Exit";
+ RTC_LOG_F(LS_VERBOSE) << "Exit";
}
//
diff --git a/rtc_base/httpcommon.cc b/rtc_base/httpcommon.cc
index b2e4869..7667faf 100644
--- a/rtc_base/httpcommon.cc
+++ b/rtc_base/httpcommon.cc
@@ -652,7 +652,7 @@
// This server's response has no version. :( NOTE: This happens for every
// response to requests made from Chrome plugins, regardless of the server's
// behaviour.
- LOG(LS_VERBOSE) << "HTTP version missing from response";
+ RTC_LOG(LS_VERBOSE) << "HTTP version missing from response";
version = HVER_UNKNOWN;
} else if ((sscanf(line, "HTTP/%u.%u %u%n",
&vmajor, &vminor, &temp_scode, &temp_pos) == 3)
@@ -828,7 +828,7 @@
if (DsMakeSpn("HTTP", server.HostAsURIString().c_str(), nullptr,
server.port(),
0, &len, spn) != ERROR_SUCCESS) {
- LOG_F(WARNING) << "(Negotiate) - DsMakeSpn failed";
+ RTC_LOG_F(WARNING) << "(Negotiate) - DsMakeSpn failed";
return HAR_IGNORE;
}
#else
@@ -869,7 +869,8 @@
if (neg) {
const size_t max_steps = 10;
if (++neg->steps >= max_steps) {
- LOG(WARNING) << "AsyncHttpsProxySocket::Authenticate(Negotiate) too many retries";
+ RTC_LOG(WARNING) << "AsyncHttpsProxySocket::Authenticate(Negotiate) "
+ "too many retries";
return HAR_ERROR;
}
steps = neg->steps;
@@ -889,10 +890,11 @@
in_buf_desc.pBuffers = &in_sec;
ret = InitializeSecurityContextA(&neg->cred, &neg->ctx, spn, flags, 0, SECURITY_NATIVE_DREP, &in_buf_desc, 0, &neg->ctx, &out_buf_desc, &ret_flags, &lifetime);
- //LOG(INFO) << "$$$ InitializeSecurityContext @ " << TimeSince(now);
+ // RTC_LOG(INFO) << "$$$ InitializeSecurityContext @ " <<
+ // TimeSince(now);
if (FAILED(ret)) {
- LOG(LS_ERROR) << "InitializeSecurityContext returned: "
- << ErrorName(ret, SECURITY_ERRORS);
+ RTC_LOG(LS_ERROR) << "InitializeSecurityContext returned: "
+ << ErrorName(ret, SECURITY_ERRORS);
return HAR_ERROR;
}
} else if (neg->specified_credentials) {
@@ -946,19 +948,20 @@
auth_id.Password = passbuf;
auth_id.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
pauth_id = &auth_id;
- LOG(LS_VERBOSE) << "Negotiate protocol: Using specified credentials";
+ RTC_LOG(LS_VERBOSE)
+ << "Negotiate protocol: Using specified credentials";
} else {
- LOG(LS_VERBOSE) << "Negotiate protocol: Using default credentials";
+ RTC_LOG(LS_VERBOSE) << "Negotiate protocol: Using default credentials";
}
CredHandle cred;
ret = AcquireCredentialsHandleA(
0, const_cast<char*>(want_negotiate ? NEGOSSP_NAME_A : NTLMSP_NAME_A),
SECPKG_CRED_OUTBOUND, 0, pauth_id, 0, 0, &cred, &lifetime);
- //LOG(INFO) << "$$$ AcquireCredentialsHandle @ " << TimeSince(now);
+ // RTC_LOG(INFO) << "$$$ AcquireCredentialsHandle @ " << TimeSince(now);
if (ret != SEC_E_OK) {
- LOG(LS_ERROR) << "AcquireCredentialsHandle error: "
- << ErrorName(ret, SECURITY_ERRORS);
+ RTC_LOG(LS_ERROR) << "AcquireCredentialsHandle error: "
+ << ErrorName(ret, SECURITY_ERRORS);
return HAR_IGNORE;
}
@@ -966,10 +969,10 @@
CtxtHandle ctx;
ret = InitializeSecurityContextA(&cred, 0, spn, flags, 0, SECURITY_NATIVE_DREP, 0, 0, &ctx, &out_buf_desc, &ret_flags, &lifetime);
- //LOG(INFO) << "$$$ InitializeSecurityContext @ " << TimeSince(now);
+ // RTC_LOG(INFO) << "$$$ InitializeSecurityContext @ " << TimeSince(now);
if (FAILED(ret)) {
- LOG(LS_ERROR) << "InitializeSecurityContext returned: "
- << ErrorName(ret, SECURITY_ERRORS);
+ RTC_LOG(LS_ERROR) << "InitializeSecurityContext returned: "
+ << ErrorName(ret, SECURITY_ERRORS);
FreeCredentialsHandle(&cred);
return HAR_IGNORE;
}
@@ -982,15 +985,15 @@
if ((ret == SEC_I_COMPLETE_NEEDED) || (ret == SEC_I_COMPLETE_AND_CONTINUE)) {
ret = CompleteAuthToken(&neg->ctx, &out_buf_desc);
- //LOG(INFO) << "$$$ CompleteAuthToken @ " << TimeSince(now);
- LOG(LS_VERBOSE) << "CompleteAuthToken returned: "
- << ErrorName(ret, SECURITY_ERRORS);
+ // RTC_LOG(INFO) << "$$$ CompleteAuthToken @ " << TimeSince(now);
+ RTC_LOG(LS_VERBOSE) << "CompleteAuthToken returned: "
+ << ErrorName(ret, SECURITY_ERRORS);
if (FAILED(ret)) {
return HAR_ERROR;
}
}
- //LOG(INFO) << "$$$ NEGOTIATE took " << TimeSince(now) << "ms";
+ // RTC_LOG(INFO) << "$$$ NEGOTIATE took " << TimeSince(now) << "ms";
std::string decoded(out_buf, out_buf + out_sec.cbBuffer);
response = auth_method;
diff --git a/rtc_base/httpserver.cc b/rtc_base/httpserver.cc
index 3f04b8f..9d5a890 100644
--- a/rtc_base/httpserver.cc
+++ b/rtc_base/httpserver.cc
@@ -30,7 +30,7 @@
HttpServer::~HttpServer() {
if (closing_) {
- LOG(LS_WARNING) << "HttpServer::CloseAll has not completed";
+ RTC_LOG(LS_WARNING) << "HttpServer::CloseAll has not completed";
}
for (ConnectionMap::iterator it = connections_.begin();
it != connections_.end();
diff --git a/rtc_base/java/src/org/webrtc/Logging.java b/rtc_base/java/src/org/webrtc/Logging.java
index fdde0bc..1e1b3d8 100644
--- a/rtc_base/java/src/org/webrtc/Logging.java
+++ b/rtc_base/java/src/org/webrtc/Logging.java
@@ -103,7 +103,7 @@
// Enable diagnostic logging for messages of |severity| to the platform debug
// output. On Android, the output will be directed to Logcat.
- // Note: this function starts collecting the output of the LOG() macros.
+ // Note: this function starts collecting the output of the RTC_LOG() macros.
// TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression.
@SuppressWarnings("NoSynchronizedMethodCheck")
public static synchronized void enableLogToDebugOutput(Severity severity) {
diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc
index b853d7c..7ceb279 100644
--- a/rtc_base/logging.cc
+++ b/rtc_base/logging.cc
@@ -443,7 +443,7 @@
void LogMultiline(LoggingSeverity level, const char* label, bool input,
const void* data, size_t len, bool hex_mode,
LogMultilineState* state) {
- if (!LOG_CHECK_LEVEL_V(level))
+ if (!RTC_LOG_CHECK_LEVEL_V(level))
return;
const char * direction = (input ? " << " : " >> ");
@@ -451,9 +451,9 @@
// null data means to flush our count of unprintable characters.
if (!data) {
if (state && state->unprintable_count_[input]) {
- LOG_V(level) << label << direction << "## "
- << state->unprintable_count_[input]
- << " consecutive unprintable ##";
+ RTC_LOG_V(level) << label << direction << "## "
+ << state->unprintable_count_[input]
+ << " consecutive unprintable ##";
state->unprintable_count_[input] = 0;
}
return;
@@ -477,8 +477,8 @@
}
asc_line[sizeof(asc_line)-1] = 0;
hex_line[sizeof(hex_line)-1] = 0;
- LOG_V(level) << label << direction
- << asc_line << " " << hex_line << " ";
+ RTC_LOG_V(level) << label << direction << asc_line << " " << hex_line
+ << " ";
udata += line_len;
len -= line_len;
}
@@ -531,8 +531,8 @@
// Print out the current line, but prefix with a count of prior unprintable
// characters.
if (consecutive_unprintable) {
- LOG_V(level) << label << direction << "## " << consecutive_unprintable
- << " consecutive unprintable ##";
+ RTC_LOG_V(level) << label << direction << "## " << consecutive_unprintable
+ << " consecutive unprintable ##";
consecutive_unprintable = 0;
}
// Strip off trailing whitespace.
@@ -546,9 +546,9 @@
pos_private = substr.find("Passwd");
}
if (pos_private == std::string::npos) {
- LOG_V(level) << label << direction << substr;
+ RTC_LOG_V(level) << label << direction << substr;
} else {
- LOG_V(level) << label << direction << "## omitted for privacy ##";
+ RTC_LOG_V(level) << label << direction << "## omitted for privacy ##";
}
}
diff --git a/rtc_base/logging_unittest.cc b/rtc_base/logging_unittest.cc
index cd5cafe..a2d35fd 100644
--- a/rtc_base/logging_unittest.cc
+++ b/rtc_base/logging_unittest.cc
@@ -44,8 +44,8 @@
LogMessage::AddLogToStream(&stream, LS_INFO);
EXPECT_EQ(LS_INFO, LogMessage::GetLogToStream(&stream));
- LOG(LS_INFO) << "INFO";
- LOG(LS_VERBOSE) << "VERBOSE";
+ RTC_LOG(LS_INFO) << "INFO";
+ RTC_LOG(LS_VERBOSE) << "VERBOSE";
EXPECT_NE(std::string::npos, str.find("INFO"));
EXPECT_EQ(std::string::npos, str.find("VERBOSE"));
@@ -68,8 +68,8 @@
EXPECT_EQ(LS_INFO, LogMessage::GetLogToStream(&stream1));
EXPECT_EQ(LS_VERBOSE, LogMessage::GetLogToStream(&stream2));
- LOG(LS_INFO) << "INFO";
- LOG(LS_VERBOSE) << "VERBOSE";
+ RTC_LOG(LS_INFO) << "INFO";
+ RTC_LOG(LS_VERBOSE) << "VERBOSE";
EXPECT_NE(std::string::npos, str1.find("INFO"));
EXPECT_EQ(std::string::npos, str1.find("VERBOSE"));
@@ -97,7 +97,7 @@
private:
void Run() override {
// LS_SENSITIVE to avoid cluttering up any real logging going on
- LOG(LS_SENSITIVE) << "LOG";
+ RTC_LOG(LS_SENSITIVE) << "RTC_LOG";
}
};
@@ -149,7 +149,7 @@
int64_t start = TimeMillis(), finish;
std::string message('X', 80);
for (int i = 0; i < 1000; ++i) {
- LOG(LS_SENSITIVE) << message;
+ RTC_LOG(LS_SENSITIVE) << message;
}
finish = TimeMillis();
@@ -157,7 +157,7 @@
stream.Close();
webrtc::test::RemoveFile(path);
- LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms";
+ RTC_LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms";
}
} // namespace rtc
diff --git a/rtc_base/macifaddrs_converter.cc b/rtc_base/macifaddrs_converter.cc
index f3b22bb..254be9b 100644
--- a/rtc_base/macifaddrs_converter.cc
+++ b/rtc_base/macifaddrs_converter.cc
@@ -220,7 +220,7 @@
if (rv >= 0) {
*native_attributes = ifr.ifr_ifru.ifru_flags;
} else {
- LOG(LS_ERROR) << "ioctl returns " << errno;
+ RTC_LOG(LS_ERROR) << "ioctl returns " << errno;
}
return (rv >= 0);
}
diff --git a/rtc_base/memory_usage.cc b/rtc_base/memory_usage.cc
index c7c361b..41b27ed 100644
--- a/rtc_base/memory_usage.cc
+++ b/rtc_base/memory_usage.cc
@@ -30,13 +30,13 @@
#if defined(WEBRTC_LINUX)
FILE* file = fopen("/proc/self/statm", "r");
if (file == nullptr) {
- LOG(LS_ERROR) << "Failed to open /proc/self/statm";
+ RTC_LOG(LS_ERROR) << "Failed to open /proc/self/statm";
return -1;
}
int result = -1;
if (fscanf(file, "%*s%d", &result) != 1) {
fclose(file);
- LOG(LS_ERROR) << "Failed to parse /proc/self/statm";
+ RTC_LOG(LS_ERROR) << "Failed to parse /proc/self/statm";
return -1;
}
fclose(file);
@@ -47,14 +47,14 @@
if (task_info(mach_task_self(), TASK_BASIC_INFO_64,
reinterpret_cast<task_info_t>(&info),
&info_count) != KERN_SUCCESS) {
- LOG_ERR(LS_ERROR) << "task_info() failed";
+ RTC_LOG_ERR(LS_ERROR) << "task_info() failed";
return -1;
}
return info.resident_size;
#elif defined(WEBRTC_WIN)
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)) == 0) {
- LOG_ERR(LS_ERROR) << "GetProcessMemoryInfo() failed";
+ RTC_LOG_ERR(LS_ERROR) << "GetProcessMemoryInfo() failed";
return -1;
}
return pmc.WorkingSetSize;
diff --git a/rtc_base/messagequeue.cc b/rtc_base/messagequeue.cc
index f863d0c..001d3ed 100644
--- a/rtc_base/messagequeue.cc
+++ b/rtc_base/messagequeue.cc
@@ -320,8 +320,9 @@
if (pmsg->ts_sensitive) {
int64_t delay = TimeDiff(msCurrent, pmsg->ts_sensitive);
if (delay > 0) {
- LOG_F(LS_WARNING) << "id: " << pmsg->message_id << " delay: "
- << (delay + kMaxMsgLatency) << "ms";
+ RTC_LOG_F(LS_WARNING)
+ << "id: " << pmsg->message_id
+ << " delay: " << (delay + kMaxMsgLatency) << "ms";
}
}
// If this was a dispose message, delete it and skip it.
@@ -531,8 +532,9 @@
int64_t end_time = TimeMillis();
int64_t diff = TimeDiff(end_time, start_time);
if (diff >= kSlowDispatchLoggingThreshold) {
- LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: "
- << pmsg->posted_from.ToString();
+ RTC_LOG(LS_INFO) << "Message took " << diff
+ << "ms to dispatch. Posted from: "
+ << pmsg->posted_from.ToString();
}
}
diff --git a/rtc_base/messagequeue_unittest.cc b/rtc_base/messagequeue_unittest.cc
index aa94962..9e1ba63 100644
--- a/rtc_base/messagequeue_unittest.cc
+++ b/rtc_base/messagequeue_unittest.cc
@@ -134,9 +134,10 @@
TEST(MessageQueueManager, Clear) {
UnwrapMainThreadScope s;
if (MessageQueueManager::IsInitialized()) {
- LOG(LS_INFO) << "Unable to run MessageQueueManager::Clear test, since the "
- << "MessageQueueManager was already initialized by some "
- << "other test in this run.";
+ RTC_LOG(LS_INFO)
+ << "Unable to run MessageQueueManager::Clear test, since the "
+ << "MessageQueueManager was already initialized by some "
+ << "other test in this run.";
return;
}
bool deleted = false;
diff --git a/rtc_base/nat_unittest.cc b/rtc_base/nat_unittest.cc
index 592fea4..d68df1d 100644
--- a/rtc_base/nat_unittest.cc
+++ b/rtc_base/nat_unittest.cc
@@ -215,7 +215,7 @@
}),
networks.end());
if (networks.empty()) {
- LOG(LS_WARNING) << "Not enough network adapters for test.";
+ RTC_LOG(LS_WARNING) << "Not enough network adapters for test.";
return;
}
@@ -232,11 +232,11 @@
}
}
if (ext_addr2.IsNil()) {
- LOG(LS_WARNING) << "No available IP of same family as " << int_addr;
+ RTC_LOG(LS_WARNING) << "No available IP of same family as " << int_addr;
return;
}
- LOG(LS_INFO) << "selected ip " << ext_addr2.ipaddr();
+ RTC_LOG(LS_INFO) << "selected ip " << ext_addr2.ipaddr();
SocketAddress ext_addrs[4] = {
SocketAddress(ext_addr1),
@@ -260,7 +260,7 @@
if (HasIPv6Enabled()) {
TestPhysicalInternal(SocketAddress("::1", 0));
} else {
- LOG(LS_WARNING) << "No IPv6, skipping";
+ RTC_LOG(LS_WARNING) << "No IPv6, skipping";
}
}
@@ -300,7 +300,7 @@
if (HasIPv6Enabled()) {
TestVirtualInternal(AF_INET6);
} else {
- LOG(LS_WARNING) << "No IPv6, skipping";
+ RTC_LOG(LS_WARNING) << "No IPv6, skipping";
}
}
diff --git a/rtc_base/natserver.cc b/rtc_base/natserver.cc
index 59bca4f..bf983fe 100644
--- a/rtc_base/natserver.cc
+++ b/rtc_base/natserver.cc
@@ -191,8 +191,8 @@
// Allow the NAT to reject this packet.
if (ShouldFilterOut(iter->second, remote_addr)) {
- LOG(LS_INFO) << "Packet from " << remote_addr.ToSensitiveString()
- << " was filtered out by the NAT.";
+ RTC_LOG(LS_INFO) << "Packet from " << remote_addr.ToSensitiveString()
+ << " was filtered out by the NAT.";
return;
}
@@ -213,7 +213,7 @@
AsyncUDPSocket* socket = AsyncUDPSocket::Create(external_, external_ip_);
if (!socket) {
- LOG(LS_ERROR) << "Couldn't find a free port!";
+ RTC_LOG(LS_ERROR) << "Couldn't find a free port!";
return;
}
diff --git a/rtc_base/natsocketfactory.cc b/rtc_base/natsocketfactory.cc
index dbcba97..dd4c030 100644
--- a/rtc_base/natsocketfactory.cc
+++ b/rtc_base/natsocketfactory.cc
@@ -189,8 +189,8 @@
*out_addr = real_remote_addr;
result = result - static_cast<int>(addrlength);
} else {
- LOG(LS_ERROR) << "Dropping packet from unknown remote address: "
- << real_remote_addr.ToString();
+ RTC_LOG(LS_ERROR) << "Dropping packet from unknown remote address: "
+ << real_remote_addr.ToString();
result = 0; // Tell the caller we didn't read anything
}
}
diff --git a/rtc_base/nethelpers.cc b/rtc_base/nethelpers.cc
index 673af0b..4702de7 100644
--- a/rtc_base/nethelpers.cc
+++ b/rtc_base/nethelpers.cc
@@ -36,7 +36,7 @@
std::vector<IPAddress>* addresses) {
#ifdef __native_client__
RTC_NOTREACHED();
- LOG(LS_WARNING) << "ResolveHostname() is not implemented for NaCl";
+ RTC_LOG(LS_WARNING) << "ResolveHostname() is not implemented for NaCl";
return -1;
#else // __native_client__
if (!addresses) {
diff --git a/rtc_base/network.cc b/rtc_base/network.cc
index bfe0fce..56d7299 100644
--- a/rtc_base/network.cc
+++ b/rtc_base/network.cc
@@ -324,7 +324,7 @@
if (pref > 0) {
--pref;
} else {
- LOG(LS_ERROR) << "Too many network interfaces to handle!";
+ RTC_LOG(LS_ERROR) << "Too many network interfaces to handle!";
break;
}
}
@@ -385,7 +385,7 @@
}
void BasicNetworkManager::OnNetworksChanged() {
- LOG(LS_INFO) << "Network change was observed";
+ RTC_LOG(LS_INFO) << "Network change was observed";
UpdateNetworksOnce();
}
@@ -394,7 +394,7 @@
bool BasicNetworkManager::CreateNetworks(bool include_ignored,
NetworkList* networks) const {
RTC_NOTREACHED();
- LOG(LS_WARNING) << "BasicNetworkManager doesn't work on NaCl yet";
+ RTC_LOG(LS_WARNING) << "BasicNetworkManager doesn't work on NaCl yet";
return false;
}
@@ -482,7 +482,8 @@
struct ifaddrs* interfaces;
int error = getifaddrs(&interfaces);
if (error != 0) {
- LOG_ERR(LERROR) << "getifaddrs failed to gather interface data: " << error;
+ RTC_LOG_ERR(LERROR) << "getifaddrs failed to gather interface data: "
+ << error;
return false;
}
@@ -646,8 +647,9 @@
bool IsDefaultRoute(const std::string& network_name) {
FileStream fs;
if (!fs.Open("/proc/net/route", "r", nullptr)) {
- LOG(LS_WARNING) << "Couldn't read /proc/net/route, skipping default "
- << "route check (assuming everything is a default route).";
+ RTC_LOG(LS_WARNING)
+ << "Couldn't read /proc/net/route, skipping default "
+ << "route check (assuming everything is a default route).";
return true;
} else {
std::string line;
@@ -821,7 +823,7 @@
std::unique_ptr<AsyncSocket> socket(
thread_->socketserver()->CreateAsyncSocket(family, SOCK_DGRAM));
if (!socket) {
- LOG_ERR(LERROR) << "Socket creation failed";
+ RTC_LOG_ERR(LERROR) << "Socket creation failed";
return IPAddress();
}
@@ -832,7 +834,7 @@
&& socket->GetError() != EHOSTUNREACH) {
// Ignore the expected case of "host/net unreachable" - which happens if
// the network is V4- or V6-only.
- LOG(LS_INFO) << "Connect failed with " << socket->GetError();
+ RTC_LOG(LS_INFO) << "Connect failed with " << socket->GetError();
}
return IPAddress();
}
@@ -870,11 +872,11 @@
void BasicNetworkManager::DumpNetworks() {
NetworkList list;
GetNetworks(&list);
- LOG(LS_INFO) << "NetworkManager detected " << list.size() << " networks:";
+ RTC_LOG(LS_INFO) << "NetworkManager detected " << list.size() << " networks:";
for (const Network* network : list) {
- LOG(LS_INFO) << network->ToString() << ": " << network->description()
- << ", active ? " << network->active()
- << ((network->ignored()) ? ", Ignored" : "");
+ RTC_LOG(LS_INFO) << network->ToString() << ": " << network->description()
+ << ", active ? " << network->active()
+ << ((network->ignored()) ? ", Ignored" : "");
}
}
diff --git a/rtc_base/network_unittest.cc b/rtc_base/network_unittest.cc
index 49b5e04..bf09c24 100644
--- a/rtc_base/network_unittest.cc
+++ b/rtc_base/network_unittest.cc
@@ -25,7 +25,7 @@
#endif // defined(WEBRTC_POSIX)
#include "rtc_base/gunit.h"
#if defined(WEBRTC_WIN)
-#include "rtc_base/logging.h" // For LOG_GLE
+#include "rtc_base/logging.h" // For RTC_LOG_GLE
#endif
namespace rtc {
@@ -250,7 +250,8 @@
reinterpret_cast<sockaddr*>(&storage),
static_cast<int>(ipsize));
#if defined(WEBRTC_WIN)
- if (success) LOG_GLE(LS_ERROR) << "Socket bind failed.";
+ if (success)
+ RTC_LOG_GLE(LS_ERROR) << "Socket bind failed.";
#endif
EXPECT_EQ(0, success);
#if defined(WEBRTC_WIN)
@@ -899,10 +900,10 @@
NetworkManager::NetworkList list;
list = GetNetworks(manager, false);
bool found_dummy = false;
- LOG(LS_INFO) << "Looking for dummy network: ";
+ RTC_LOG(LS_INFO) << "Looking for dummy network: ";
for (NetworkManager::NetworkList::iterator it = list.begin();
it != list.end(); ++it) {
- LOG(LS_INFO) << " Network name: " << (*it)->name();
+ RTC_LOG(LS_INFO) << " Network name: " << (*it)->name();
found_dummy |= (*it)->name().find("dummy0") != std::string::npos;
}
for (NetworkManager::NetworkList::iterator it = list.begin();
@@ -910,16 +911,16 @@
delete (*it);
}
if (!found_dummy) {
- LOG(LS_INFO) << "No dummy found, quitting.";
+ RTC_LOG(LS_INFO) << "No dummy found, quitting.";
return;
}
- LOG(LS_INFO) << "Found dummy, running again while ignoring non-default "
- << "routes.";
+ RTC_LOG(LS_INFO) << "Found dummy, running again while ignoring non-default "
+ << "routes.";
manager.set_ignore_non_default_routes(true);
list = GetNetworks(manager, false);
for (NetworkManager::NetworkList::iterator it = list.begin();
it != list.end(); ++it) {
- LOG(LS_INFO) << " Network name: " << (*it)->name();
+ RTC_LOG(LS_INFO) << " Network name: " << (*it)->name();
EXPECT_TRUE((*it)->name().find("dummy0") == std::string::npos);
}
for (NetworkManager::NetworkList::iterator it = list.begin();
diff --git a/rtc_base/networkmonitor.cc b/rtc_base/networkmonitor.cc
index 6a81e93..0272951 100644
--- a/rtc_base/networkmonitor.cc
+++ b/rtc_base/networkmonitor.cc
@@ -30,7 +30,7 @@
NetworkMonitorBase::~NetworkMonitorBase() {}
void NetworkMonitorBase::OnNetworksChanged() {
- LOG(LS_VERBOSE) << "Network change is received at the network monitor";
+ RTC_LOG(LS_VERBOSE) << "Network change is received at the network monitor";
worker_thread_->Post(RTC_FROM_HERE, this, UPDATE_NETWORKS_MESSAGE);
}
diff --git a/rtc_base/onetimeevent.h b/rtc_base/onetimeevent.h
index 7ef0376..8c55e26 100644
--- a/rtc_base/onetimeevent.h
+++ b/rtc_base/onetimeevent.h
@@ -21,7 +21,7 @@
// OneTimeEvent firstFrame;
// ...
// if (firstFrame()) {
-// LOG(LS_INFO) << "This is the first frame".
+// RTC_LOG(LS_INFO) << "This is the first frame".
// }
class OneTimeEvent {
public:
diff --git a/rtc_base/openssladapter.cc b/rtc_base/openssladapter.cc
index f0ecf09..a5ef0fe 100644
--- a/rtc_base/openssladapter.cc
+++ b/rtc_base/openssladapter.cc
@@ -163,8 +163,8 @@
do {
error_code = ERR_get_error_line(&file, &line);
if (ERR_GET_LIB(error_code) == ERR_LIB_SSL) {
- LOG(LS_ERROR) << "ERR_LIB_SSL: " << error_code << ", " << file << ":"
- << line;
+ RTC_LOG(LS_ERROR) << "ERR_LIB_SSL: " << error_code << ", " << file << ":"
+ << line;
break;
}
} while (error_code != 0);
@@ -368,7 +368,7 @@
}
int OpenSSLAdapter::BeginSSL() {
- LOG(LS_INFO) << "OpenSSLAdapter::BeginSSL: " << ssl_host_name_;
+ RTC_LOG(LS_INFO) << "OpenSSLAdapter::BeginSSL: " << ssl_host_name_;
RTC_DCHECK(state_ == SSL_CONNECTING);
int err = 0;
@@ -426,13 +426,13 @@
SSL_SESSION* cached = factory_->LookupSession(ssl_host_name_);
if (cached) {
if (SSL_set_session(ssl_, cached) == 0) {
- LOG(LS_WARNING) << "Failed to apply SSL session from cache";
+ RTC_LOG(LS_WARNING) << "Failed to apply SSL session from cache";
err = -1;
goto ssl_error;
}
- LOG(LS_INFO) << "Attempting to resume SSL session to "
- << ssl_host_name_;
+ RTC_LOG(LS_INFO) << "Attempting to resume SSL session to "
+ << ssl_host_name_;
}
}
}
@@ -484,7 +484,7 @@
switch (SSL_get_error(ssl_, code)) {
case SSL_ERROR_NONE:
if (!SSLPostConnectionCheck(ssl_, ssl_host_name_.c_str())) {
- LOG(LS_ERROR) << "TLS post connection check failed";
+ RTC_LOG(LS_ERROR) << "TLS post connection check failed";
// make sure we close the socket
Cleanup();
// The connect failed so return -1 to shut down the socket
@@ -496,15 +496,15 @@
#if 0 // TODO: worry about this
// Don't let ourselves go away during the callbacks
PRefPtr<OpenSSLAdapter> lock(this);
- LOG(LS_INFO) << " -- onStreamReadable";
+ RTC_LOG(LS_INFO) << " -- onStreamReadable";
AsyncSocketAdapter::OnReadEvent(this);
- LOG(LS_INFO) << " -- onStreamWriteable";
+ RTC_LOG(LS_INFO) << " -- onStreamWriteable";
AsyncSocketAdapter::OnWriteEvent(this);
#endif
break;
case SSL_ERROR_WANT_READ:
- LOG(LS_VERBOSE) << " -- error want read";
+ RTC_LOG(LS_VERBOSE) << " -- error want read";
struct timeval timeout;
if (DTLSv1_get_timeout(ssl_, &timeout)) {
int delay = timeout.tv_sec * 1000 + timeout.tv_usec/1000;
@@ -519,7 +519,7 @@
case SSL_ERROR_ZERO_RETURN:
default:
- LOG(LS_WARNING) << "ContinueSSL -- error " << code;
+ RTC_LOG(LS_WARNING) << "ContinueSSL -- error " << code;
return (code != 0) ? code : -1;
}
@@ -527,8 +527,8 @@
}
void OpenSSLAdapter::Error(const char* context, int err, bool signal) {
- LOG(LS_WARNING) << "OpenSSLAdapter::Error("
- << context << ", " << err << ")";
+ RTC_LOG(LS_WARNING) << "OpenSSLAdapter::Error(" << context << ", " << err
+ << ")";
state_ = SSL_ERROR;
SetError(err);
if (signal)
@@ -536,7 +536,7 @@
}
void OpenSSLAdapter::Cleanup() {
- LOG(LS_INFO) << "OpenSSLAdapter::Cleanup";
+ RTC_LOG(LS_INFO) << "OpenSSLAdapter::Cleanup";
state_ = SSL_NONE;
ssl_read_needs_write_ = false;
@@ -573,16 +573,16 @@
// Success!
return ret;
case SSL_ERROR_WANT_READ:
- LOG(LS_INFO) << " -- error want read";
+ RTC_LOG(LS_INFO) << " -- error want read";
ssl_write_needs_read_ = true;
SetError(EWOULDBLOCK);
break;
case SSL_ERROR_WANT_WRITE:
- LOG(LS_INFO) << " -- error want write";
+ RTC_LOG(LS_INFO) << " -- error want write";
SetError(EWOULDBLOCK);
break;
case SSL_ERROR_ZERO_RETURN:
- // LOG(LS_INFO) << " -- remote side closed";
+ // RTC_LOG(LS_INFO) << " -- remote side closed";
SetError(EWOULDBLOCK);
// do we need to signal closure?
break;
@@ -591,7 +591,7 @@
Error("SSL_write", ret ? ret : -1, false);
break;
default:
- LOG(LS_WARNING) << "Unknown error from SSL_write: " << *error;
+ RTC_LOG(LS_WARNING) << "Unknown error from SSL_write: " << *error;
Error("SSL_write", ret ? ret : -1, false);
break;
}
@@ -604,7 +604,7 @@
//
int OpenSSLAdapter::Send(const void* pv, size_t cb) {
- //LOG(LS_INFO) << "OpenSSLAdapter::Send(" << cb << ")";
+ // RTC_LOG(LS_INFO) << "OpenSSLAdapter::Send(" << cb << ")";
switch (state_) {
case SSL_NONE:
@@ -661,7 +661,7 @@
if (error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE) {
// Shouldn't be able to get to this point if we already have pending data.
RTC_DCHECK(pending_data_.empty());
- LOG(LS_WARNING)
+ RTC_LOG(LS_WARNING)
<< "SSL_write couldn't write to the underlying socket; buffering data.";
pending_data_.SetData(static_cast<const uint8_t*>(pv), cb);
// Since we're taking responsibility for sending this data, return its full
@@ -686,7 +686,7 @@
}
int OpenSSLAdapter::Recv(void* pv, size_t cb, int64_t* timestamp) {
- //LOG(LS_INFO) << "OpenSSLAdapter::Recv(" << cb << ")";
+ // RTC_LOG(LS_INFO) << "OpenSSLAdapter::Recv(" << cb << ")";
switch (state_) {
case SSL_NONE:
@@ -715,19 +715,19 @@
int error = SSL_get_error(ssl_, code);
switch (error) {
case SSL_ERROR_NONE:
- // LOG(LS_INFO) << " -- success";
+ // RTC_LOG(LS_INFO) << " -- success";
return code;
case SSL_ERROR_WANT_READ:
- // LOG(LS_INFO) << " -- error want read";
+ // RTC_LOG(LS_INFO) << " -- error want read";
SetError(EWOULDBLOCK);
break;
case SSL_ERROR_WANT_WRITE:
- // LOG(LS_INFO) << " -- error want write";
+ // RTC_LOG(LS_INFO) << " -- error want write";
ssl_read_needs_write_ = true;
SetError(EWOULDBLOCK);
break;
case SSL_ERROR_ZERO_RETURN:
- // LOG(LS_INFO) << " -- remote side closed";
+ // RTC_LOG(LS_INFO) << " -- remote side closed";
SetError(EWOULDBLOCK);
// do we need to signal closure?
break;
@@ -736,7 +736,7 @@
Error("SSL_read", (code ? code : -1), false);
break;
default:
- LOG(LS_WARNING) << "Unknown error from SSL_read: " << error;
+ RTC_LOG(LS_WARNING) << "Unknown error from SSL_read: " << error;
Error("SSL_read", (code ? code : -1), false);
break;
}
@@ -783,14 +783,14 @@
void OpenSSLAdapter::OnMessage(Message* msg) {
if (MSG_TIMEOUT == msg->message_id) {
- LOG(LS_INFO) << "DTLS timeout expired";
+ RTC_LOG(LS_INFO) << "DTLS timeout expired";
DTLSv1_handle_timeout(ssl_);
ContinueSSL();
}
}
void OpenSSLAdapter::OnConnectEvent(AsyncSocket* socket) {
- LOG(LS_INFO) << "OpenSSLAdapter::OnConnectEvent";
+ RTC_LOG(LS_INFO) << "OpenSSLAdapter::OnConnectEvent";
if (state_ != SSL_WAIT) {
RTC_DCHECK(state_ == SSL_NONE);
AsyncSocketAdapter::OnConnectEvent(socket);
@@ -804,7 +804,7 @@
}
void OpenSSLAdapter::OnReadEvent(AsyncSocket* socket) {
- //LOG(LS_INFO) << "OpenSSLAdapter::OnReadEvent";
+ // RTC_LOG(LS_INFO) << "OpenSSLAdapter::OnReadEvent";
if (state_ == SSL_NONE) {
AsyncSocketAdapter::OnReadEvent(socket);
@@ -824,16 +824,16 @@
// Don't let ourselves go away during the callbacks
//PRefPtr<OpenSSLAdapter> lock(this); // TODO: fix this
if (ssl_write_needs_read_) {
- //LOG(LS_INFO) << " -- onStreamWriteable";
+ // RTC_LOG(LS_INFO) << " -- onStreamWriteable";
AsyncSocketAdapter::OnWriteEvent(socket);
}
- //LOG(LS_INFO) << " -- onStreamReadable";
+ // RTC_LOG(LS_INFO) << " -- onStreamReadable";
AsyncSocketAdapter::OnReadEvent(socket);
}
void OpenSSLAdapter::OnWriteEvent(AsyncSocket* socket) {
- //LOG(LS_INFO) << "OpenSSLAdapter::OnWriteEvent";
+ // RTC_LOG(LS_INFO) << "OpenSSLAdapter::OnWriteEvent";
if (state_ == SSL_NONE) {
AsyncSocketAdapter::OnWriteEvent(socket);
@@ -854,7 +854,7 @@
//PRefPtr<OpenSSLAdapter> lock(this); // TODO: fix this
if (ssl_read_needs_write_) {
- //LOG(LS_INFO) << " -- onStreamReadable";
+ // RTC_LOG(LS_INFO) << " -- onStreamReadable";
AsyncSocketAdapter::OnReadEvent(socket);
}
@@ -868,12 +868,12 @@
}
}
- //LOG(LS_INFO) << " -- onStreamWriteable";
+ // RTC_LOG(LS_INFO) << " -- onStreamWriteable";
AsyncSocketAdapter::OnWriteEvent(socket);
}
void OpenSSLAdapter::OnCloseEvent(AsyncSocket* socket, int err) {
- LOG(LS_INFO) << "OpenSSLAdapter::OnCloseEvent(" << err << ")";
+ RTC_LOG(LS_INFO) << "OpenSSLAdapter::OnCloseEvent(" << err << ")";
AsyncSocketAdapter::OnCloseEvent(socket, err);
}
@@ -892,18 +892,18 @@
// Logging certificates is extremely verbose. So it is disabled by default.
#ifdef LOG_CERTIFICATES
{
- LOG(LS_INFO) << "Certificate from server:";
+ RTC_LOG(LS_INFO) << "Certificate from server:";
BIO* mem = BIO_new(BIO_s_mem());
X509_print_ex(mem, certificate, XN_FLAG_SEP_CPLUS_SPC, X509_FLAG_NO_HEADER);
BIO_write(mem, "\0", 1);
char* buffer;
BIO_get_mem_data(mem, &buffer);
- LOG(LS_INFO) << buffer;
+ RTC_LOG(LS_INFO) << buffer;
BIO_free(mem);
char* cipher_description =
SSL_CIPHER_description(SSL_get_current_cipher(ssl), nullptr, 128);
- LOG(LS_INFO) << "Cipher: " << cipher_description;
+ RTC_LOG(LS_INFO) << "Cipher: " << cipher_description;
OPENSSL_free(cipher_description);
}
#endif
@@ -944,8 +944,8 @@
// This should only ever be turned on for debugging and development.
if (!ok && ignore_bad_cert) {
- LOG(LS_WARNING) << "TLS certificate check FAILED. "
- << "Allowing connection anyway.";
+ RTC_LOG(LS_WARNING) << "TLS certificate check FAILED. "
+ << "Allowing connection anyway.";
ok = true;
}
@@ -961,7 +961,7 @@
}
if (!ok && ignore_bad_cert_) {
- LOG(LS_INFO) << "Other TLS post connection checks failed.";
+ RTC_LOG(LS_INFO) << "Other TLS post connection checks failed.";
ok = true;
}
@@ -981,17 +981,17 @@
str = "SSL_accept";
}
if (where & SSL_CB_LOOP) {
- LOG(LS_INFO) << str << ":" << SSL_state_string_long(s);
+ RTC_LOG(LS_INFO) << str << ":" << SSL_state_string_long(s);
} else if (where & SSL_CB_ALERT) {
str = (where & SSL_CB_READ) ? "read" : "write";
- LOG(LS_INFO) << "SSL3 alert " << str
- << ":" << SSL_alert_type_string_long(ret)
- << ":" << SSL_alert_desc_string_long(ret);
+ RTC_LOG(LS_INFO) << "SSL3 alert " << str << ":"
+ << SSL_alert_type_string_long(ret) << ":"
+ << SSL_alert_desc_string_long(ret);
} else if (where & SSL_CB_EXIT) {
if (ret == 0) {
- LOG(LS_INFO) << str << ":failed in " << SSL_state_string_long(s);
+ RTC_LOG(LS_INFO) << str << ":failed in " << SSL_state_string_long(s);
} else if (ret < 0) {
- LOG(LS_INFO) << str << ":error in " << SSL_state_string_long(s);
+ RTC_LOG(LS_INFO) << str << ":error in " << SSL_state_string_long(s);
}
}
}
@@ -1006,13 +1006,13 @@
int depth = X509_STORE_CTX_get_error_depth(store);
int err = X509_STORE_CTX_get_error(store);
- LOG(LS_INFO) << "Error with certificate at depth: " << depth;
+ RTC_LOG(LS_INFO) << "Error with certificate at depth: " << depth;
X509_NAME_oneline(X509_get_issuer_name(cert), data, sizeof(data));
- LOG(LS_INFO) << " issuer = " << data;
+ RTC_LOG(LS_INFO) << " issuer = " << data;
X509_NAME_oneline(X509_get_subject_name(cert), data, sizeof(data));
- LOG(LS_INFO) << " subject = " << data;
- LOG(LS_INFO) << " err = " << err
- << ":" << X509_verify_cert_error_string(err);
+ RTC_LOG(LS_INFO) << " subject = " << data;
+ RTC_LOG(LS_INFO) << " err = " << err << ":"
+ << X509_verify_cert_error_string(err);
}
#endif
@@ -1029,14 +1029,14 @@
reinterpret_cast<void*>(X509_STORE_CTX_get_current_cert(store));
if (custom_verify_callback_(cert)) {
stream->custom_verification_succeeded_ = true;
- LOG(LS_INFO) << "validated certificate using custom callback";
+ RTC_LOG(LS_INFO) << "validated certificate using custom callback";
ok = true;
}
}
// Should only be used for debugging and development.
if (!ok && stream->ignore_bad_cert_) {
- LOG(LS_WARNING) << "Ignoring cert error while verifying cert chain";
+ RTC_LOG(LS_WARNING) << "Ignoring cert error while verifying cert chain";
ok = 1;
}
@@ -1047,7 +1047,7 @@
OpenSSLAdapter* stream =
reinterpret_cast<OpenSSLAdapter*>(SSL_get_app_data(ssl));
RTC_DCHECK(stream->factory_);
- LOG(LS_INFO) << "Caching SSL session for " << stream->ssl_host_name_;
+ RTC_LOG(LS_INFO) << "Caching SSL session for " << stream->ssl_host_name_;
stream->factory_->AddSession(stream->ssl_host_name_, session);
return 1; // We've taken ownership of the session; OpenSSL shouldn't free it.
}
@@ -1063,7 +1063,7 @@
if (cert) {
int return_value = X509_STORE_add_cert(SSL_CTX_get_cert_store(ctx), cert);
if (return_value == 0) {
- LOG(LS_WARNING) << "Unable to add certificate.";
+ RTC_LOG(LS_WARNING) << "Unable to add certificate.";
} else {
count_of_added_certs++;
}
@@ -1087,9 +1087,9 @@
#endif // OPENSSL_IS_BORINGSSL
if (ctx == nullptr) {
unsigned long error = ERR_get_error(); // NOLINT: type used by OpenSSL.
- LOG(LS_WARNING) << "SSL_CTX creation failed: "
- << '"' << ERR_reason_error_string(error) << "\" "
- << "(error=" << error << ')';
+ RTC_LOG(LS_WARNING) << "SSL_CTX creation failed: " << '"'
+ << ERR_reason_error_string(error) << "\" "
+ << "(error=" << error << ')';
return nullptr;
}
if (!ConfigureTrustedRootCertificates(ctx)) {
@@ -1131,14 +1131,14 @@
std::string transformed_alpn;
for (const std::string& proto : alpn_protocols) {
if (proto.size() == 0 || proto.size() > 0xFF) {
- LOG(LS_ERROR) << "OpenSSLAdapter::Error("
- << "TransformAlpnProtocols received proto with size "
- << proto.size() << ")";
+ RTC_LOG(LS_ERROR) << "OpenSSLAdapter::Error("
+ << "TransformAlpnProtocols received proto with size "
+ << proto.size() << ")";
return "";
}
transformed_alpn += static_cast<char>(proto.size());
transformed_alpn += proto;
- LOG(LS_VERBOSE) << "TransformAlpnProtocols: Adding proto: " << proto;
+ RTC_LOG(LS_VERBOSE) << "TransformAlpnProtocols: Adding proto: " << proto;
}
return transformed_alpn;
}
diff --git a/rtc_base/opensslidentity.cc b/rtc_base/opensslidentity.cc
index 075a1b5..8eb1c42 100644
--- a/rtc_base/opensslidentity.cc
+++ b/rtc_base/opensslidentity.cc
@@ -38,7 +38,7 @@
// Generate a key pair. Caller is responsible for freeing the returned object.
static EVP_PKEY* MakeKey(const KeyParams& key_params) {
- LOG(LS_INFO) << "Making key pair";
+ RTC_LOG(LS_INFO) << "Making key pair";
EVP_PKEY* pkey = EVP_PKEY_new();
if (key_params.type() == KT_RSA) {
int key_length = key_params.rsa_params().mod_size;
@@ -51,7 +51,7 @@
EVP_PKEY_free(pkey);
BN_free(exponent);
RSA_free(rsa);
- LOG(LS_ERROR) << "Failed to make RSA key pair";
+ RTC_LOG(LS_ERROR) << "Failed to make RSA key pair";
return nullptr;
}
// ownership of rsa struct was assigned, don't free it.
@@ -70,30 +70,30 @@
!EVP_PKEY_assign_EC_KEY(pkey, ec_key)) {
EVP_PKEY_free(pkey);
EC_KEY_free(ec_key);
- LOG(LS_ERROR) << "Failed to make EC key pair";
+ RTC_LOG(LS_ERROR) << "Failed to make EC key pair";
return nullptr;
}
// ownership of ec_key struct was assigned, don't free it.
} else {
// Add generation of any other curves here.
EVP_PKEY_free(pkey);
- LOG(LS_ERROR) << "ECDSA key requested for unknown curve";
+ RTC_LOG(LS_ERROR) << "ECDSA key requested for unknown curve";
return nullptr;
}
} else {
EVP_PKEY_free(pkey);
- LOG(LS_ERROR) << "Key type requested not understood";
+ RTC_LOG(LS_ERROR) << "Key type requested not understood";
return nullptr;
}
- LOG(LS_INFO) << "Returning key pair";
+ RTC_LOG(LS_INFO) << "Returning key pair";
return pkey;
}
// Generate a self-signed certificate, with the public key from the
// given key pair. Caller is responsible for freeing the returned object.
static X509* MakeCertificate(EVP_PKEY* pkey, const SSLIdentityParams& params) {
- LOG(LS_INFO) << "Making certificate for " << params.common_name;
+ RTC_LOG(LS_INFO) << "Making certificate for " << params.common_name;
X509* x509 = nullptr;
BIGNUM* serial_number = nullptr;
X509_NAME* name = nullptr;
@@ -140,7 +140,7 @@
BN_free(serial_number);
X509_NAME_free(name);
- LOG(LS_INFO) << "Returning certificate";
+ RTC_LOG(LS_INFO) << "Returning certificate";
return x509;
error:
@@ -157,7 +157,7 @@
while ((err = ERR_get_error()) != 0) {
ERR_error_string_n(err, error_buf, sizeof(error_buf));
- LOG(LS_ERROR) << prefix << ": " << error_buf << "\n";
+ RTC_LOG(LS_ERROR) << prefix << ": " << error_buf << "\n";
}
}
@@ -174,7 +174,7 @@
const std::string& pem_string) {
BIO* bio = BIO_new_mem_buf(const_cast<char*>(pem_string.c_str()), -1);
if (!bio) {
- LOG(LS_ERROR) << "Failed to create a new BIO buffer.";
+ RTC_LOG(LS_ERROR) << "Failed to create a new BIO buffer.";
return nullptr;
}
BIO_set_mem_eof_return(bio, 0);
@@ -182,11 +182,12 @@
PEM_read_bio_PrivateKey(bio, nullptr, nullptr, const_cast<char*>("\0"));
BIO_free(bio); // Frees the BIO, but not the pointed-to string.
if (!pkey) {
- LOG(LS_ERROR) << "Failed to create the private key from PEM string.";
+ RTC_LOG(LS_ERROR) << "Failed to create the private key from PEM string.";
return nullptr;
}
if (EVP_PKEY_missing_parameters(pkey) != 0) {
- LOG(LS_ERROR) << "The resulting key pair is missing public key parameters.";
+ RTC_LOG(LS_ERROR)
+ << "The resulting key pair is missing public key parameters.";
EVP_PKEY_free(pkey);
return nullptr;
}
@@ -213,13 +214,13 @@
std::string OpenSSLKeyPair::PrivateKeyToPEMString() const {
BIO* temp_memory_bio = BIO_new(BIO_s_mem());
if (!temp_memory_bio) {
- LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
+ RTC_LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
RTC_NOTREACHED();
return "";
}
if (!PEM_write_bio_PrivateKey(
temp_memory_bio, pkey_, nullptr, nullptr, 0, nullptr, nullptr)) {
- LOG_F(LS_ERROR) << "Failed to write private key";
+ RTC_LOG_F(LS_ERROR) << "Failed to write private key";
BIO_free(temp_memory_bio);
RTC_NOTREACHED();
return "";
@@ -235,12 +236,12 @@
std::string OpenSSLKeyPair::PublicKeyToPEMString() const {
BIO* temp_memory_bio = BIO_new(BIO_s_mem());
if (!temp_memory_bio) {
- LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
+ RTC_LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
RTC_NOTREACHED();
return "";
}
if (!PEM_write_bio_PUBKEY(temp_memory_bio, pkey_)) {
- LOG_F(LS_ERROR) << "Failed to write public key";
+ RTC_LOG_F(LS_ERROR) << "Failed to write public key";
BIO_free(temp_memory_bio);
RTC_NOTREACHED();
return "";
@@ -266,14 +267,14 @@
static void PrintCert(X509* x509) {
BIO* temp_memory_bio = BIO_new(BIO_s_mem());
if (!temp_memory_bio) {
- LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
+ RTC_LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
return;
}
X509_print_ex(temp_memory_bio, x509, XN_FLAG_SEP_CPLUS_SPC, 0);
BIO_write(temp_memory_bio, "\0", 1);
char* buffer;
BIO_get_mem_data(temp_memory_bio, &buffer);
- LOG(LS_VERBOSE) << buffer;
+ RTC_LOG(LS_VERBOSE) << buffer;
BIO_free(temp_memory_bio);
}
#endif
@@ -354,7 +355,7 @@
default:
// Unknown algorithm. There are several unhandled options that are less
// common and more complex.
- LOG(LS_ERROR) << "Unknown signature algorithm NID: " << nid;
+ RTC_LOG(LS_ERROR) << "Unknown signature algorithm NID: " << nid;
algorithm->clear();
return false;
}
@@ -492,7 +493,7 @@
return new OpenSSLIdentity(key_pair, certificate);
delete key_pair;
}
- LOG(LS_INFO) << "Identity generation failed";
+ RTC_LOG(LS_INFO) << "Identity generation failed";
return nullptr;
}
@@ -522,14 +523,14 @@
std::unique_ptr<OpenSSLCertificate> cert(
OpenSSLCertificate::FromPEMString(certificate));
if (!cert) {
- LOG(LS_ERROR) << "Failed to create OpenSSLCertificate from PEM string.";
+ RTC_LOG(LS_ERROR) << "Failed to create OpenSSLCertificate from PEM string.";
return nullptr;
}
OpenSSLKeyPair* key_pair =
OpenSSLKeyPair::FromPrivateKeyPEMString(private_key);
if (!key_pair) {
- LOG(LS_ERROR) << "Failed to create key pair from PEM string.";
+ RTC_LOG(LS_ERROR) << "Failed to create key pair from PEM string.";
return nullptr;
}
diff --git a/rtc_base/opensslstreamadapter.cc b/rtc_base/opensslstreamadapter.cc
index ec9f238..c1ce2c6 100644
--- a/rtc_base/opensslstreamadapter.cc
+++ b/rtc_base/opensslstreamadapter.cc
@@ -303,7 +303,7 @@
}
if (!OpenSSLDigest::GetDigestSize(digest_alg, &expected_len)) {
- LOG(LS_WARNING) << "Unknown digest algorithm: " << digest_alg;
+ RTC_LOG(LS_WARNING) << "Unknown digest algorithm: " << digest_alg;
if (error) {
*error = SSLPeerCertificateDigestError::UNKNOWN_ALGORITHM;
}
@@ -437,7 +437,7 @@
}
if (!found) {
- LOG(LS_ERROR) << "Could not find cipher: " << *cipher;
+ RTC_LOG(LS_ERROR) << "Could not find cipher: " << *cipher;
return false;
}
}
@@ -511,7 +511,7 @@
StreamResult OpenSSLStreamAdapter::Write(const void* data, size_t data_len,
size_t* written, int* error) {
- LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::Write(" << data_len << ")";
+ RTC_LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::Write(" << data_len << ")";
switch (state_) {
case SSL_NONE:
@@ -549,18 +549,18 @@
int ssl_error = SSL_get_error(ssl_, code);
switch (ssl_error) {
case SSL_ERROR_NONE:
- LOG(LS_VERBOSE) << " -- success";
+ RTC_LOG(LS_VERBOSE) << " -- success";
RTC_DCHECK_GT(code, 0);
RTC_DCHECK_LE(code, data_len);
if (written)
*written = code;
return SR_SUCCESS;
case SSL_ERROR_WANT_READ:
- LOG(LS_VERBOSE) << " -- error want read";
+ RTC_LOG(LS_VERBOSE) << " -- error want read";
ssl_write_needs_read_ = true;
return SR_BLOCK;
case SSL_ERROR_WANT_WRITE:
- LOG(LS_VERBOSE) << " -- error want write";
+ RTC_LOG(LS_VERBOSE) << " -- error want write";
return SR_BLOCK;
case SSL_ERROR_ZERO_RETURN:
@@ -575,7 +575,7 @@
StreamResult OpenSSLStreamAdapter::Read(void* data, size_t data_len,
size_t* read, int* error) {
- LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::Read(" << data_len << ")";
+ RTC_LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::Read(" << data_len << ")";
switch (state_) {
case SSL_NONE:
// pass-through in clear text
@@ -614,7 +614,7 @@
int ssl_error = SSL_get_error(ssl_, code);
switch (ssl_error) {
case SSL_ERROR_NONE:
- LOG(LS_VERBOSE) << " -- success";
+ RTC_LOG(LS_VERBOSE) << " -- success";
RTC_DCHECK_GT(code, 0);
RTC_DCHECK_LE(code, data_len);
if (read)
@@ -625,7 +625,7 @@
unsigned int pending = SSL_pending(ssl_);
if (pending) {
- LOG(LS_INFO) << " -- short DTLS read. flushing";
+ RTC_LOG(LS_INFO) << " -- short DTLS read. flushing";
FlushInput(pending);
if (error)
*error = SSE_MSG_TRUNC;
@@ -634,19 +634,19 @@
}
return SR_SUCCESS;
case SSL_ERROR_WANT_READ:
- LOG(LS_VERBOSE) << " -- error want read";
+ RTC_LOG(LS_VERBOSE) << " -- error want read";
return SR_BLOCK;
case SSL_ERROR_WANT_WRITE:
- LOG(LS_VERBOSE) << " -- error want write";
+ RTC_LOG(LS_VERBOSE) << " -- error want write";
ssl_read_needs_write_ = true;
return SR_BLOCK;
case SSL_ERROR_ZERO_RETURN:
- LOG(LS_VERBOSE) << " -- remote side closed";
+ RTC_LOG(LS_VERBOSE) << " -- remote side closed";
Close();
return SR_EOS;
break;
default:
- LOG(LS_VERBOSE) << " -- error " << code;
+ RTC_LOG(LS_VERBOSE) << " -- error " << code;
Error("SSL_read", (ssl_error ? ssl_error : -1), 0, false);
if (error)
*error = ssl_error_code_;
@@ -667,12 +667,12 @@
RTC_DCHECK(ssl_error == SSL_ERROR_NONE);
if (ssl_error != SSL_ERROR_NONE) {
- LOG(LS_VERBOSE) << " -- error " << code;
+ RTC_LOG(LS_VERBOSE) << " -- error " << code;
Error("SSL_read", (ssl_error ? ssl_error : -1), 0, false);
return;
}
- LOG(LS_VERBOSE) << " -- flushed " << code << " bytes";
+ RTC_LOG(LS_VERBOSE) << " -- flushed " << code << " bytes";
left -= code;
}
}
@@ -708,7 +708,7 @@
int signal_error = 0;
RTC_DCHECK(stream == this->stream());
if ((events & SE_OPEN)) {
- LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::OnEvent SE_OPEN";
+ RTC_LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::OnEvent SE_OPEN";
if (state_ != SSL_WAIT) {
RTC_DCHECK(state_ == SSL_NONE);
events_to_signal |= SE_OPEN;
@@ -721,9 +721,9 @@
}
}
if ((events & (SE_READ|SE_WRITE))) {
- LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::OnEvent"
- << ((events & SE_READ) ? " SE_READ" : "")
- << ((events & SE_WRITE) ? " SE_WRITE" : "");
+ RTC_LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::OnEvent"
+ << ((events & SE_READ) ? " SE_READ" : "")
+ << ((events & SE_WRITE) ? " SE_WRITE" : "");
if (state_ == SSL_NONE) {
events_to_signal |= events & (SE_READ|SE_WRITE);
} else if (state_ == SSL_CONNECTING) {
@@ -734,18 +734,19 @@
} else if (state_ == SSL_CONNECTED) {
if (((events & SE_READ) && ssl_write_needs_read_) ||
(events & SE_WRITE)) {
- LOG(LS_VERBOSE) << " -- onStreamWriteable";
+ RTC_LOG(LS_VERBOSE) << " -- onStreamWriteable";
events_to_signal |= SE_WRITE;
}
if (((events & SE_WRITE) && ssl_read_needs_write_) ||
(events & SE_READ)) {
- LOG(LS_VERBOSE) << " -- onStreamReadable";
+ RTC_LOG(LS_VERBOSE) << " -- onStreamReadable";
events_to_signal |= SE_READ;
}
}
}
if ((events & SE_CLOSE)) {
- LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::OnEvent(SE_CLOSE, " << err << ")";
+ RTC_LOG(LS_VERBOSE) << "OpenSSLStreamAdapter::OnEvent(SE_CLOSE, " << err
+ << ")";
Cleanup(0);
events_to_signal |= SE_CLOSE;
// SE_CLOSE is the only event that uses the final parameter to OnEvent().
@@ -759,7 +760,7 @@
int OpenSSLStreamAdapter::BeginSSL() {
RTC_DCHECK(state_ == SSL_CONNECTING);
// The underlying stream has opened.
- LOG(LS_INFO) << "BeginSSL with peer.";
+ RTC_LOG(LS_INFO) << "BeginSSL with peer.";
BIO* bio = nullptr;
@@ -813,7 +814,7 @@
}
int OpenSSLStreamAdapter::ContinueSSL() {
- LOG(LS_VERBOSE) << "ContinueSSL";
+ RTC_LOG(LS_VERBOSE) << "ContinueSSL";
RTC_DCHECK(state_ == SSL_CONNECTING);
// Clear the DTLS timer
@@ -823,7 +824,7 @@
int ssl_error;
switch (ssl_error = SSL_get_error(ssl_, code)) {
case SSL_ERROR_NONE:
- LOG(LS_VERBOSE) << " -- success";
+ RTC_LOG(LS_VERBOSE) << " -- success";
// By this point, OpenSSL should have given us a certificate, or errored
// out if one was missing.
RTC_DCHECK(peer_certificate_ || !client_auth_enabled());
@@ -844,24 +845,24 @@
break;
case SSL_ERROR_WANT_READ: {
- LOG(LS_VERBOSE) << " -- error want read";
- struct timeval timeout;
- if (DTLSv1_get_timeout(ssl_, &timeout)) {
- int delay = timeout.tv_sec * 1000 + timeout.tv_usec/1000;
+ RTC_LOG(LS_VERBOSE) << " -- error want read";
+ struct timeval timeout;
+ if (DTLSv1_get_timeout(ssl_, &timeout)) {
+ int delay = timeout.tv_sec * 1000 + timeout.tv_usec / 1000;
- Thread::Current()->PostDelayed(RTC_FROM_HERE, delay, this,
- MSG_TIMEOUT, 0);
+ Thread::Current()->PostDelayed(RTC_FROM_HERE, delay, this, MSG_TIMEOUT,
+ 0);
}
}
break;
case SSL_ERROR_WANT_WRITE:
- LOG(LS_VERBOSE) << " -- error want write";
+ RTC_LOG(LS_VERBOSE) << " -- error want write";
break;
case SSL_ERROR_ZERO_RETURN:
default:
- LOG(LS_VERBOSE) << " -- error " << code;
+ RTC_LOG(LS_VERBOSE) << " -- error " << code;
SSLHandshakeError ssl_handshake_err = SSLHandshakeError::UNKNOWN;
int err_code = ERR_peek_last_error();
if (err_code != 0 && ERR_GET_REASON(err_code) == SSL_R_NO_SHARED_CIPHER) {
@@ -878,8 +879,8 @@
int err,
uint8_t alert,
bool signal) {
- LOG(LS_WARNING) << "OpenSSLStreamAdapter::Error(" << context << ", " << err
- << ", " << static_cast<int>(alert) << ")";
+ RTC_LOG(LS_WARNING) << "OpenSSLStreamAdapter::Error(" << context << ", "
+ << err << ", " << static_cast<int>(alert) << ")";
state_ = SSL_ERROR;
ssl_error_code_ = err;
Cleanup(alert);
@@ -888,7 +889,7 @@
}
void OpenSSLStreamAdapter::Cleanup(uint8_t alert) {
- LOG(LS_INFO) << "Cleanup";
+ RTC_LOG(LS_INFO) << "Cleanup";
if (state_ != SSL_ERROR) {
state_ = SSL_CLOSED;
@@ -902,15 +903,15 @@
if (alert) {
ret = SSL_send_fatal_alert(ssl_, alert);
if (ret < 0) {
- LOG(LS_WARNING) << "SSL_send_fatal_alert failed, error = "
- << SSL_get_error(ssl_, ret);
+ RTC_LOG(LS_WARNING) << "SSL_send_fatal_alert failed, error = "
+ << SSL_get_error(ssl_, ret);
}
} else {
#endif
ret = SSL_shutdown(ssl_);
if (ret < 0) {
- LOG(LS_WARNING) << "SSL_shutdown failed, error = "
- << SSL_get_error(ssl_, ret);
+ RTC_LOG(LS_WARNING)
+ << "SSL_shutdown failed, error = " << SSL_get_error(ssl_, ret);
}
#ifdef OPENSSL_IS_BORINGSSL
}
@@ -933,7 +934,7 @@
void OpenSSLStreamAdapter::OnMessage(Message* msg) {
// Process our own messages and then pass others to the superclass
if (MSG_TIMEOUT == msg->message_id) {
- LOG(LS_INFO) << "DTLS timeout expired";
+ RTC_LOG(LS_INFO) << "DTLS timeout expired";
DTLSv1_handle_timeout(ssl_);
ContinueSSL();
} else {
@@ -1076,7 +1077,7 @@
bool OpenSSLStreamAdapter::VerifyPeerCertificate() {
if (!has_peer_certificate_digest() || !peer_certificate_) {
- LOG(LS_WARNING) << "Missing digest or peer certificate.";
+ RTC_LOG(LS_WARNING) << "Missing digest or peer certificate.";
return false;
}
@@ -1085,19 +1086,20 @@
if (!OpenSSLCertificate::ComputeDigest(
peer_certificate_->x509(), peer_certificate_digest_algorithm_, digest,
sizeof(digest), &digest_length)) {
- LOG(LS_WARNING) << "Failed to compute peer cert digest.";
+ RTC_LOG(LS_WARNING) << "Failed to compute peer cert digest.";
return false;
}
Buffer computed_digest(digest, digest_length);
if (computed_digest != peer_certificate_digest_value_) {
- LOG(LS_WARNING) << "Rejected peer certificate due to mismatched digest.";
+ RTC_LOG(LS_WARNING)
+ << "Rejected peer certificate due to mismatched digest.";
return false;
}
// Ignore any verification error if the digest matches, since there is no
// value in checking the validity of a self-signed cert issued by untrusted
// sources.
- LOG(LS_INFO) << "Accepted peer certificate.";
+ RTC_LOG(LS_INFO) << "Accepted peer certificate.";
peer_certificate_verified_ = true;
return true;
}
@@ -1117,7 +1119,7 @@
// If the peer certificate digest isn't known yet, we'll wait to verify
// until it's known, and for now just return a success status.
if (stream->peer_certificate_digest_algorithm_.empty()) {
- LOG(LS_INFO) << "Waiting to verify certificate until digest is known.";
+ RTC_LOG(LS_INFO) << "Waiting to verify certificate until digest is known.";
return 1;
}
diff --git a/rtc_base/optionsfile.cc b/rtc_base/optionsfile.cc
index a76270d..c3b6a6a 100644
--- a/rtc_base/optionsfile.cc
+++ b/rtc_base/optionsfile.cc
@@ -29,7 +29,7 @@
FileStream stream;
int err;
if (!stream.Open(path_, "r", &err)) {
- LOG_F(LS_WARNING) << "Could not open file, err=" << err;
+ RTC_LOG_F(LS_WARNING) << "Could not open file, err=" << err;
// We do not consider this an error because we expect there to be no file
// until the user saves a setting.
return true;
@@ -46,7 +46,7 @@
if (equals_pos == std::string::npos) {
// We do not consider this an error. Instead we ignore the line and
// keep going.
- LOG_F(LS_WARNING) << "Ignoring malformed line in " << path_;
+ RTC_LOG_F(LS_WARNING) << "Ignoring malformed line in " << path_;
continue;
}
std::string key(line, 0, equals_pos);
@@ -54,7 +54,7 @@
options_[key] = value;
}
if (res != SR_EOS) {
- LOG_F(LS_ERROR) << "Error when reading from file";
+ RTC_LOG_F(LS_ERROR) << "Error when reading from file";
return false;
} else {
return true;
@@ -66,7 +66,7 @@
FileStream stream;
int err;
if (!stream.Open(path_, "w", &err)) {
- LOG_F(LS_ERROR) << "Could not open file, err=" << err;
+ RTC_LOG_F(LS_ERROR) << "Could not open file, err=" << err;
return false;
}
// Write out all the data.
@@ -95,7 +95,7 @@
}
}
if (res != SR_SUCCESS) {
- LOG_F(LS_ERROR) << "Unable to write to file";
+ RTC_LOG_F(LS_ERROR) << "Unable to write to file";
return false;
} else {
return true;
@@ -106,7 +106,7 @@
for (size_t pos = 0; pos < name.length(); ++pos) {
if (name[pos] == '\n' || name[pos] == '\\' || name[pos] == '=') {
// Illegal character.
- LOG(LS_WARNING) << "Ignoring operation for illegal option " << name;
+ RTC_LOG(LS_WARNING) << "Ignoring operation for illegal option " << name;
return false;
}
}
@@ -117,7 +117,7 @@
for (size_t pos = 0; pos < value.length(); ++pos) {
if (value[pos] == '\n' || value[pos] == '\\') {
// Illegal character.
- LOG(LS_WARNING) << "Ignoring operation for illegal value " << value;
+ RTC_LOG(LS_WARNING) << "Ignoring operation for illegal value " << value;
return false;
}
}
@@ -126,8 +126,7 @@
bool OptionsFile::GetStringValue(const std::string& option,
std::string *out_val) const {
- LOG(LS_VERBOSE) << "OptionsFile::GetStringValue "
- << option;
+ RTC_LOG(LS_VERBOSE) << "OptionsFile::GetStringValue " << option;
if (!IsLegalName(option)) {
return false;
}
@@ -141,8 +140,7 @@
bool OptionsFile::GetIntValue(const std::string& option,
int *out_val) const {
- LOG(LS_VERBOSE) << "OptionsFile::GetIntValue "
- << option;
+ RTC_LOG(LS_VERBOSE) << "OptionsFile::GetIntValue " << option;
if (!IsLegalName(option)) {
return false;
}
@@ -155,8 +153,8 @@
bool OptionsFile::SetStringValue(const std::string& option,
const std::string& value) {
- LOG(LS_VERBOSE) << "OptionsFile::SetStringValue "
- << option << ":" << value;
+ RTC_LOG(LS_VERBOSE) << "OptionsFile::SetStringValue " << option << ":"
+ << value;
if (!IsLegalName(option) || !IsLegalValue(value)) {
return false;
}
@@ -166,8 +164,7 @@
bool OptionsFile::SetIntValue(const std::string& option,
int value) {
- LOG(LS_VERBOSE) << "OptionsFile::SetIntValue "
- << option << ":" << value;
+ RTC_LOG(LS_VERBOSE) << "OptionsFile::SetIntValue " << option << ":" << value;
if (!IsLegalName(option)) {
return false;
}
@@ -175,7 +172,7 @@
}
bool OptionsFile::RemoveValue(const std::string& option) {
- LOG(LS_VERBOSE) << "OptionsFile::RemoveValue " << option;
+ RTC_LOG(LS_VERBOSE) << "OptionsFile::RemoveValue " << option;
if (!IsLegalName(option)) {
return false;
}
diff --git a/rtc_base/physicalsocketserver.cc b/rtc_base/physicalsocketserver.cc
index db27827..422171d 100644
--- a/rtc_base/physicalsocketserver.cc
+++ b/rtc_base/physicalsocketserver.cc
@@ -182,8 +182,8 @@
if (result >= 0) {
SocketAddressFromSockAddrStorage(addr_storage, &address);
} else {
- LOG(LS_WARNING) << "GetLocalAddress: unable to get local addr, socket="
- << s_;
+ RTC_LOG(LS_WARNING) << "GetLocalAddress: unable to get local addr, socket="
+ << s_;
}
return address;
}
@@ -197,8 +197,8 @@
if (result >= 0) {
SocketAddressFromSockAddrStorage(addr_storage, &address);
} else {
- LOG(LS_WARNING) << "GetRemoteAddress: unable to get remote addr, socket="
- << s_;
+ RTC_LOG(LS_WARNING)
+ << "GetRemoteAddress: unable to get remote addr, socket=" << s_;
}
return address;
}
@@ -217,19 +217,19 @@
// the bind() call; bind() just needs to assign a port.
copied_bind_addr.SetIP(GetAnyIP(copied_bind_addr.ipaddr().family()));
} else if (result == NetworkBindingResult::NOT_IMPLEMENTED) {
- LOG(LS_INFO) << "Can't bind socket to network because "
- "network binding is not implemented for this OS.";
+ RTC_LOG(LS_INFO) << "Can't bind socket to network because "
+ "network binding is not implemented for this OS.";
} else {
if (bind_addr.IsLoopbackIP()) {
// If we couldn't bind to a loopback IP (which should only happen in
// test scenarios), continue on. This may be expected behavior.
- LOG(LS_VERBOSE) << "Binding socket to loopback address "
- << bind_addr.ipaddr().ToString()
- << " failed; result: " << static_cast<int>(result);
+ RTC_LOG(LS_VERBOSE) << "Binding socket to loopback address "
+ << bind_addr.ipaddr().ToString()
+ << " failed; result: " << static_cast<int>(result);
} else {
- LOG(LS_WARNING) << "Binding socket to network address "
- << bind_addr.ipaddr().ToString()
- << " failed; result: " << static_cast<int>(result);
+ RTC_LOG(LS_WARNING) << "Binding socket to network address "
+ << bind_addr.ipaddr().ToString()
+ << " failed; result: " << static_cast<int>(result);
// If a network binding was attempted and failed, we should stop here
// and not try to use the socket. Otherwise, we may end up sending
// packets with an invalid source address.
@@ -260,7 +260,7 @@
return SOCKET_ERROR;
}
if (addr.IsUnresolvedIP()) {
- LOG(LS_VERBOSE) << "Resolving addr in PhysicalSocket::Connect";
+ RTC_LOG(LS_VERBOSE) << "Resolving addr in PhysicalSocket::Connect";
resolver_ = new AsyncResolver();
resolver_->SignalDone.connect(this, &PhysicalSocket::OnResolveResult);
resolver_->Start(addr);
@@ -394,7 +394,7 @@
// Note: on graceful shutdown, recv can return 0. In this case, we
// pretend it is blocking, and then signal close, so that simplifying
// assumptions can be made about Recv.
- LOG(LS_WARNING) << "EOF from socket; deferring close event";
+ RTC_LOG(LS_WARNING) << "EOF from socket; deferring close event";
// Must turn this back on so that the select() loop will notice the close
// event.
EnableEvents(DE_READ);
@@ -411,7 +411,7 @@
EnableEvents(DE_READ);
}
if (!success) {
- LOG_F(LS_VERBOSE) << "Error = " << error;
+ RTC_LOG_F(LS_VERBOSE) << "Error = " << error;
}
return received;
}
@@ -437,7 +437,7 @@
EnableEvents(DE_READ);
}
if (!success) {
- LOG_F(LS_VERBOSE) << "Error = " << error;
+ RTC_LOG_F(LS_VERBOSE) << "Error = " << error;
}
return received;
}
@@ -525,7 +525,7 @@
}
void PhysicalSocket::UpdateLastError() {
- SetError(LAST_SYSTEM_ERROR);
+ SetError(RTC_LAST_SYSTEM_ERROR);
}
void PhysicalSocket::MaybeRemapSendError() {
@@ -561,7 +561,7 @@
*sopt = IP_DONTFRAGMENT;
break;
#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
- LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
+ RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
return -1;
#elif defined(WEBRTC_POSIX)
*slevel = IPPROTO_IP;
@@ -581,7 +581,7 @@
*sopt = TCP_NODELAY;
break;
case OPT_DSCP:
- LOG(LS_WARNING) << "Socket::OPT_DSCP not supported.";
+ RTC_LOG(LS_WARNING) << "Socket::OPT_DSCP not supported.";
return -1;
case OPT_RTP_SENDTIME_EXTN_ID:
return -1; // No logging is necessary as this not a OS socket option.
@@ -727,7 +727,7 @@
// "connection lost"-type error as a blocking error, because typically
// the next recv() will get EOF, so we'll still eventually notice that
// the socket is closed.
- LOG_ERR(LS_WARNING) << "Assuming benign blocking error";
+ RTC_LOG_ERR(LS_WARNING) << "Assuming benign blocking error";
return false;
}
}
@@ -759,7 +759,7 @@
// something like a READ followed by a CONNECT, which would be odd.
if (((ff & DE_CONNECT) != 0) && (id_ == cache_id)) {
if (ff != DE_CONNECT)
- LOG(LS_VERBOSE) << "Signalled with DE_CONNECT: " << ff;
+ RTC_LOG(LS_VERBOSE) << "Signalled with DE_CONNECT: " << ff;
DisableEvents(DE_CONNECT);
#if !defined(NDEBUG)
dbg_addr_ = "Connected @ ";
@@ -895,7 +895,7 @@
public:
EventDispatcher(PhysicalSocketServer* ss) : ss_(ss), fSignaled_(false) {
if (pipe(afd_) < 0)
- LOG(LERROR) << "pipe failed";
+ RTC_LOG(LERROR) << "pipe failed";
ss_->Add(this);
}
@@ -1012,14 +1012,14 @@
private:
PosixSignalHandler() {
if (pipe(afd_) < 0) {
- LOG_ERR(LS_ERROR) << "pipe failed";
+ RTC_LOG_ERR(LS_ERROR) << "pipe failed";
return;
}
if (fcntl(afd_[0], F_SETFL, O_NONBLOCK) < 0) {
- LOG_ERR(LS_WARNING) << "fcntl #1 failed";
+ RTC_LOG_ERR(LS_WARNING) << "fcntl #1 failed";
}
if (fcntl(afd_[1], F_SETFL, O_NONBLOCK) < 0) {
- LOG_ERR(LS_WARNING) << "fcntl #2 failed";
+ RTC_LOG_ERR(LS_WARNING) << "fcntl #2 failed";
}
memset(const_cast<void *>(static_cast<volatile void *>(received_signal_)),
0,
@@ -1076,9 +1076,9 @@
uint8_t b[16];
ssize_t ret = read(GetDescriptor(), b, sizeof(b));
if (ret < 0) {
- LOG_ERR(LS_WARNING) << "Error in read()";
+ RTC_LOG_ERR(LS_WARNING) << "Error in read()";
} else if (ret == 0) {
- LOG(LS_WARNING) << "Should have read at least one byte";
+ RTC_LOG(LS_WARNING) << "Should have read at least one byte";
}
}
@@ -1092,7 +1092,7 @@
// This can happen if a signal is delivered to our process at around
// the same time as we unset our handler for it. It is not an error
// condition, but it's unusual enough to be worth logging.
- LOG(LS_INFO) << "Received signal with no handler: " << signum;
+ RTC_LOG(LS_INFO) << "Received signal with no handler: " << signum;
} else {
// Otherwise, execute our handler.
(*i->second)(signum);
@@ -1209,7 +1209,7 @@
epoll_fd_ = epoll_create(FD_SETSIZE);
if (epoll_fd_ == -1) {
// Not an error, will fall back to "select" below.
- LOG_E(LS_WARNING, EN, errno) << "epoll_create";
+ RTC_LOG_E(LS_WARNING, EN, errno) << "epoll_create";
epoll_fd_ = INVALID_SOCKET;
}
#endif
@@ -1305,16 +1305,17 @@
// invalidating the iterator in "Wait".
if (!pending_add_dispatchers_.erase(pdispatcher) &&
dispatchers_.find(pdispatcher) == dispatchers_.end()) {
- LOG(LS_WARNING) << "PhysicalSocketServer asked to remove a unknown "
- << "dispatcher, potentially from a duplicate call to "
- << "Add.";
+ RTC_LOG(LS_WARNING) << "PhysicalSocketServer asked to remove a unknown "
+ << "dispatcher, potentially from a duplicate call to "
+ << "Add.";
return;
}
pending_remove_dispatchers_.insert(pdispatcher);
} else if (!dispatchers_.erase(pdispatcher)) {
- LOG(LS_WARNING) << "PhysicalSocketServer asked to remove a unknown "
- << "dispatcher, potentially from a duplicate call to Add.";
+ RTC_LOG(LS_WARNING)
+ << "PhysicalSocketServer asked to remove a unknown "
+ << "dispatcher, potentially from a duplicate call to Add.";
return;
}
#if defined(WEBRTC_USE_EPOLL)
@@ -1494,7 +1495,7 @@
// If error, return error.
if (n < 0) {
if (errno != EINTR) {
- LOG_E(LS_ERROR, EN, errno) << "select";
+ RTC_LOG_E(LS_ERROR, EN, errno) << "select";
return false;
}
// Else ignore the error and keep going. If this EINTR was for one of the
@@ -1577,7 +1578,7 @@
int err = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, fd, &event);
RTC_DCHECK_EQ(err, 0);
if (err == -1) {
- LOG_E(LS_ERROR, EN, errno) << "epoll_ctl EPOLL_CTL_ADD";
+ RTC_LOG_E(LS_ERROR, EN, errno) << "epoll_ctl EPOLL_CTL_ADD";
}
}
@@ -1595,9 +1596,9 @@
if (err == -1) {
if (errno == ENOENT) {
// Socket has already been closed.
- LOG_E(LS_VERBOSE, EN, errno) << "epoll_ctl EPOLL_CTL_DEL";
+ RTC_LOG_E(LS_VERBOSE, EN, errno) << "epoll_ctl EPOLL_CTL_DEL";
} else {
- LOG_E(LS_ERROR, EN, errno) << "epoll_ctl EPOLL_CTL_DEL";
+ RTC_LOG_E(LS_ERROR, EN, errno) << "epoll_ctl EPOLL_CTL_DEL";
}
}
}
@@ -1616,7 +1617,7 @@
int err = epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, fd, &event);
RTC_DCHECK_EQ(err, 0);
if (err == -1) {
- LOG_E(LS_ERROR, EN, errno) << "epoll_ctl EPOLL_CTL_MOD";
+ RTC_LOG_E(LS_ERROR, EN, errno) << "epoll_ctl EPOLL_CTL_MOD";
}
}
@@ -1646,7 +1647,7 @@
static_cast<int>(tvWait));
if (n < 0) {
if (errno != EINTR) {
- LOG_E(LS_ERROR, EN, errno) << "epoll";
+ RTC_LOG_E(LS_ERROR, EN, errno) << "epoll";
return false;
}
// Else ignore the error and keep going. If this EINTR was for one of the
@@ -1727,7 +1728,7 @@
int n = poll(&fds, 1, static_cast<int>(tvWait));
if (n < 0) {
if (errno != EINTR) {
- LOG_E(LS_ERROR, EN, errno) << "poll";
+ RTC_LOG_E(LS_ERROR, EN, errno) << "poll";
return false;
}
// Else ignore the error and keep going. If this EINTR was for one of the
@@ -1801,7 +1802,7 @@
struct sigaction act;
// It doesn't really matter what we set this mask to.
if (sigemptyset(&act.sa_mask) != 0) {
- LOG_ERR(LS_ERROR) << "Couldn't set mask";
+ RTC_LOG_ERR(LS_ERROR) << "Couldn't set mask";
return false;
}
act.sa_handler = handler;
@@ -1814,7 +1815,7 @@
act.sa_flags = 0;
#endif
if (sigaction(signum, &act, nullptr) != 0) {
- LOG_ERR(LS_ERROR) << "Couldn't set sigaction";
+ RTC_LOG_ERR(LS_ERROR) << "Couldn't set sigaction";
return false;
}
return true;
@@ -1914,28 +1915,33 @@
{
if ((wsaEvents.lNetworkEvents & FD_READ) &&
wsaEvents.iErrorCode[FD_READ_BIT] != 0) {
- LOG(WARNING) << "PhysicalSocketServer got FD_READ_BIT error "
- << wsaEvents.iErrorCode[FD_READ_BIT];
+ RTC_LOG(WARNING)
+ << "PhysicalSocketServer got FD_READ_BIT error "
+ << wsaEvents.iErrorCode[FD_READ_BIT];
}
if ((wsaEvents.lNetworkEvents & FD_WRITE) &&
wsaEvents.iErrorCode[FD_WRITE_BIT] != 0) {
- LOG(WARNING) << "PhysicalSocketServer got FD_WRITE_BIT error "
- << wsaEvents.iErrorCode[FD_WRITE_BIT];
+ RTC_LOG(WARNING)
+ << "PhysicalSocketServer got FD_WRITE_BIT error "
+ << wsaEvents.iErrorCode[FD_WRITE_BIT];
}
if ((wsaEvents.lNetworkEvents & FD_CONNECT) &&
wsaEvents.iErrorCode[FD_CONNECT_BIT] != 0) {
- LOG(WARNING) << "PhysicalSocketServer got FD_CONNECT_BIT error "
- << wsaEvents.iErrorCode[FD_CONNECT_BIT];
+ RTC_LOG(WARNING)
+ << "PhysicalSocketServer got FD_CONNECT_BIT error "
+ << wsaEvents.iErrorCode[FD_CONNECT_BIT];
}
if ((wsaEvents.lNetworkEvents & FD_ACCEPT) &&
wsaEvents.iErrorCode[FD_ACCEPT_BIT] != 0) {
- LOG(WARNING) << "PhysicalSocketServer got FD_ACCEPT_BIT error "
- << wsaEvents.iErrorCode[FD_ACCEPT_BIT];
+ RTC_LOG(WARNING)
+ << "PhysicalSocketServer got FD_ACCEPT_BIT error "
+ << wsaEvents.iErrorCode[FD_ACCEPT_BIT];
}
if ((wsaEvents.lNetworkEvents & FD_CLOSE) &&
wsaEvents.iErrorCode[FD_CLOSE_BIT] != 0) {
- LOG(WARNING) << "PhysicalSocketServer got FD_CLOSE_BIT error "
- << wsaEvents.iErrorCode[FD_CLOSE_BIT];
+ RTC_LOG(WARNING)
+ << "PhysicalSocketServer got FD_CLOSE_BIT error "
+ << wsaEvents.iErrorCode[FD_CLOSE_BIT];
}
}
uint32_t ff = 0;
diff --git a/rtc_base/physicalsocketserver_unittest.cc b/rtc_base/physicalsocketserver_unittest.cc
index 2320e97..d09385bb 100644
--- a/rtc_base/physicalsocketserver_unittest.cc
+++ b/rtc_base/physicalsocketserver_unittest.cc
@@ -22,16 +22,16 @@
namespace rtc {
-#define MAYBE_SKIP_IPV4 \
- if (!HasIPv4Enabled()) { \
- LOG(LS_INFO) << "No IPv4... skipping"; \
- return; \
+#define MAYBE_SKIP_IPV4 \
+ if (!HasIPv4Enabled()) { \
+ RTC_LOG(LS_INFO) << "No IPv4... skipping"; \
+ return; \
}
-#define MAYBE_SKIP_IPV6 \
- if (!HasIPv6Enabled()) { \
- LOG(LS_INFO) << "No IPv6... skipping"; \
- return; \
+#define MAYBE_SKIP_IPV6 \
+ if (!HasIPv6Enabled()) { \
+ RTC_LOG(LS_INFO) << "No IPv6... skipping"; \
+ return; \
}
class PhysicalSocketTest;
@@ -516,12 +516,12 @@
bool ExpectSignal(int signum) {
if (signals_received_.empty()) {
- LOG(LS_ERROR) << "ExpectSignal(): No signal received";
+ RTC_LOG(LS_ERROR) << "ExpectSignal(): No signal received";
return false;
}
if (signals_received_[0] != signum) {
- LOG(LS_ERROR) << "ExpectSignal(): Received signal " <<
- signals_received_[0] << ", expected " << signum;
+ RTC_LOG(LS_ERROR) << "ExpectSignal(): Received signal "
+ << signals_received_[0] << ", expected " << signum;
return false;
}
signals_received_.erase(signals_received_.begin());
@@ -531,8 +531,8 @@
bool ExpectNone() {
bool ret = signals_received_.empty();
if (!ret) {
- LOG(LS_ERROR) << "ExpectNone(): Received signal " << signals_received_[0]
- << ", expected none";
+ RTC_LOG(LS_ERROR) << "ExpectNone(): Received signal "
+ << signals_received_[0] << ", expected none";
}
return ret;
}
diff --git a/rtc_base/proxyserver.cc b/rtc_base/proxyserver.cc
index ede2968..5ab7943 100644
--- a/rtc_base/proxyserver.cc
+++ b/rtc_base/proxyserver.cc
@@ -53,7 +53,8 @@
ext_socket->Bind(ext_ip_);
bindings_.push_back(new ProxyBinding(wrapped_socket, ext_socket));
} else {
- LOG(LS_ERROR) << "Unable to create external socket on proxy accept event";
+ RTC_LOG(LS_ERROR)
+ << "Unable to create external socket on proxy accept event";
}
}
diff --git a/rtc_base/socket_unittest.cc b/rtc_base/socket_unittest.cc
index 9e44572..a31cc02 100644
--- a/rtc_base/socket_unittest.cc
+++ b/rtc_base/socket_unittest.cc
@@ -32,10 +32,10 @@
using webrtc::testing::SSE_WRITE;
using webrtc::testing::StreamSink;
-#define MAYBE_SKIP_IPV6 \
- if (!HasIPv6Enabled()) { \
- LOG(LS_INFO) << "No IPv6... skipping"; \
- return; \
+#define MAYBE_SKIP_IPV6 \
+ if (!HasIPv6Enabled()) { \
+ RTC_LOG(LS_INFO) << "No IPv6... skipping"; \
+ return; \
}
// Data size to be used in TcpInternal tests.
@@ -60,7 +60,7 @@
void SocketTest::TestConnectWithDnsLookupIPv6() {
// TODO: Enable this when DNS resolution supports IPv6.
- LOG(LS_INFO) << "Skipping IPv6 DNS test";
+ RTC_LOG(LS_INFO) << "Skipping IPv6 DNS test";
// ConnectWithDnsLookupInternal(kIPv6Loopback, "localhost6");
}
@@ -377,8 +377,8 @@
WAIT_(client->GetState() == AsyncSocket::CS_CLOSED, kTimeout,
dns_lookup_finished);
if (!dns_lookup_finished) {
- LOG(LS_WARNING) << "Skipping test; DNS resolution took longer than 5 "
- << "seconds.";
+ RTC_LOG(LS_WARNING) << "Skipping test; DNS resolution took longer than 5 "
+ << "seconds.";
return;
}
@@ -970,8 +970,8 @@
if (ret != test_packet_size) {
error = client->GetError();
if (error == expected_error) {
- LOG(LS_INFO) << "Got expected error code after sending "
- << sent_packet_num << " packets.";
+ RTC_LOG(LS_INFO) << "Got expected error code after sending "
+ << sent_packet_num << " packets.";
break;
}
}
@@ -979,7 +979,7 @@
EXPECT_EQ(expected_error, error);
EXPECT_FALSE(client->ready_to_send());
EXPECT_TRUE_WAIT(client->ready_to_send(), kTimeout);
- LOG(LS_INFO) << "Got SignalReadyToSend";
+ RTC_LOG(LS_INFO) << "Got SignalReadyToSend";
}
void SocketTest::GetSetOptionsInternal(const IPAddress& loopback) {
diff --git a/rtc_base/socketadapters.cc b/rtc_base/socketadapters.cc
index 175110b..4cde690 100644
--- a/rtc_base/socketadapters.cc
+++ b/rtc_base/socketadapters.cc
@@ -104,7 +104,7 @@
}
if (data_len_ >= buffer_size_) {
- LOG(INFO) << "Input buffer overflow";
+ RTC_LOG(INFO) << "Input buffer overflow";
RTC_NOTREACHED();
data_len_ = 0;
}
@@ -113,7 +113,7 @@
socket_->Recv(buffer_ + data_len_, buffer_size_ - data_len_, nullptr);
if (len < 0) {
// TODO: Do something better like forwarding the error to the user.
- LOG_ERR(INFO) << "Recv";
+ RTC_LOG_ERR(INFO) << "Recv";
return;
}
@@ -260,8 +260,8 @@
int AsyncHttpsProxySocket::Connect(const SocketAddress& addr) {
int ret;
- LOG(LS_VERBOSE) << "AsyncHttpsProxySocket::Connect("
- << proxy_.ToSensitiveString() << ")";
+ RTC_LOG(LS_VERBOSE) << "AsyncHttpsProxySocket::Connect("
+ << proxy_.ToSensitiveString() << ")";
dest_ = addr;
state_ = PS_INIT;
if (ShouldIssueConnect()) {
@@ -296,7 +296,7 @@
}
void AsyncHttpsProxySocket::OnConnectEvent(AsyncSocket * socket) {
- LOG(LS_VERBOSE) << "AsyncHttpsProxySocket::OnConnectEvent";
+ RTC_LOG(LS_VERBOSE) << "AsyncHttpsProxySocket::OnConnectEvent";
if (!ShouldIssueConnect()) {
state_ = PS_TUNNEL;
BufferedReadAdapter::OnConnectEvent(socket);
@@ -306,7 +306,7 @@
}
void AsyncHttpsProxySocket::OnCloseEvent(AsyncSocket * socket, int err) {
- LOG(LS_VERBOSE) << "AsyncHttpsProxySocket::OnCloseEvent(" << err << ")";
+ RTC_LOG(LS_VERBOSE) << "AsyncHttpsProxySocket::OnCloseEvent(" << err << ")";
if ((state_ == PS_WAIT_CLOSE) && (err == 0)) {
state_ = PS_ERROR;
Connect(dest_);
@@ -380,11 +380,11 @@
content_length_ = 0;
headers_.clear();
- LOG(LS_VERBOSE) << "AsyncHttpsProxySocket >> " << str;
+ RTC_LOG(LS_VERBOSE) << "AsyncHttpsProxySocket >> " << str;
}
void AsyncHttpsProxySocket::ProcessLine(char * data, size_t len) {
- LOG(LS_VERBOSE) << "AsyncHttpsProxySocket << " << data;
+ RTC_LOG(LS_VERBOSE) << "AsyncHttpsProxySocket << " << data;
if (len == 0) {
if (state_ == PS_TUNNEL_HEADERS) {
@@ -419,7 +419,7 @@
#endif
#if defined(WEBRTC_POSIX)
// TODO: Raise a signal so the UI can be separated.
- LOG(LS_ERROR) << "Oops!\n\n" << msg;
+ RTC_LOG(LS_ERROR) << "Oops!\n\n" << msg;
#endif
}
// Unexpected end of headers
@@ -455,7 +455,7 @@
proxy_, "CONNECT", "/",
user_, pass_, context_, response, auth_method)) {
case HAR_IGNORE:
- LOG(LS_VERBOSE) << "Ignoring Proxy-Authenticate: " << auth_method;
+ RTC_LOG(LS_VERBOSE) << "Ignoring Proxy-Authenticate: " << auth_method;
if (!unknown_mechanisms_.empty())
unknown_mechanisms_.append(", ");
unknown_mechanisms_.append(auth_method);
@@ -610,7 +610,7 @@
if (!response.ReadUInt32(&addr) ||
!response.ReadUInt16(&port))
return;
- LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
+ RTC_LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
} else if (atyp == 3) {
uint8_t len;
std::string addr;
@@ -618,13 +618,13 @@
!response.ReadString(&addr, len) ||
!response.ReadUInt16(&port))
return;
- LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
+ RTC_LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
} else if (atyp == 4) {
std::string addr;
if (!response.ReadString(&addr, 16) ||
!response.ReadUInt16(&port))
return;
- LOG(LS_VERBOSE) << "Bound on <IPV6>:" << port;
+ RTC_LOG(LS_VERBOSE) << "Bound on <IPV6>:" << port;
} else {
Error(0);
return;
diff --git a/rtc_base/ssladapter_unittest.cc b/rtc_base/ssladapter_unittest.cc
index f82f89b..0996b01 100644
--- a/rtc_base/ssladapter_unittest.cc
+++ b/rtc_base/ssladapter_unittest.cc
@@ -81,13 +81,13 @@
}
int Connect(const std::string& hostname, const rtc::SocketAddress& address) {
- LOG(LS_INFO) << "Initiating connection with " << address;
+ RTC_LOG(LS_INFO) << "Initiating connection with " << address;
int rv = ssl_adapter_->Connect(address);
if (rv == 0) {
- LOG(LS_INFO) << "Starting " << GetSSLProtocolName(ssl_mode_)
- << " handshake with " << hostname;
+ RTC_LOG(LS_INFO) << "Starting " << GetSSLProtocolName(ssl_mode_)
+ << " handshake with " << hostname;
if (ssl_adapter_->StartSSL(hostname.c_str(), false) != 0) {
return -1;
@@ -102,7 +102,7 @@
}
int Send(const std::string& message) {
- LOG(LS_INFO) << "Client sending '" << message << "'";
+ RTC_LOG(LS_INFO) << "Client sending '" << message << "'";
return ssl_adapter_->Send(message.data(), message.length());
}
@@ -115,7 +115,7 @@
if (read != -1) {
buffer[read] = '\0';
- LOG(LS_INFO) << "Client received '" << buffer << "'";
+ RTC_LOG(LS_INFO) << "Client received '" << buffer << "'";
data_ += buffer;
}
@@ -155,8 +155,9 @@
server_socket_->Listen(1);
}
- LOG(LS_INFO) << ((ssl_mode_ == rtc::SSL_MODE_DTLS) ? "UDP" : "TCP")
- << " server listening on " << server_socket_->GetLocalAddress();
+ RTC_LOG(LS_INFO) << ((ssl_mode_ == rtc::SSL_MODE_DTLS) ? "UDP" : "TCP")
+ << " server listening on "
+ << server_socket_->GetLocalAddress();
}
rtc::SocketAddress GetAddress() const {
@@ -180,7 +181,7 @@
return -1;
}
- LOG(LS_INFO) << "Server sending '" << message << "'";
+ RTC_LOG(LS_INFO) << "Server sending '" << message << "'";
size_t written;
int error;
@@ -228,7 +229,7 @@
stream->Read(buffer, sizeof(buffer) - 1, &read, &error);
if (r == rtc::SR_SUCCESS) {
buffer[read] = '\0';
- LOG(LS_INFO) << "Server received '" << buffer << "'";
+ RTC_LOG(LS_INFO) << "Server received '" << buffer << "'";
data_ += buffer;
}
}
@@ -321,14 +322,15 @@
EXPECT_EQ_WAIT(rtc::AsyncSocket::CS_CONNECTED, client_->GetState(),
handshake_wait_);
- LOG(LS_INFO) << GetSSLProtocolName(ssl_mode_) << " handshake complete.";
+ RTC_LOG(LS_INFO) << GetSSLProtocolName(ssl_mode_)
+ << " handshake complete.";
} else {
// On handshake failure the client should end up in the CS_CLOSED state.
EXPECT_EQ_WAIT(rtc::AsyncSocket::CS_CLOSED, client_->GetState(),
handshake_wait_);
- LOG(LS_INFO) << GetSSLProtocolName(ssl_mode_) << " handshake failed.";
+ RTC_LOG(LS_INFO) << GetSSLProtocolName(ssl_mode_) << " handshake failed.";
}
}
@@ -347,7 +349,7 @@
// The client should have received the server's message.
EXPECT_EQ_WAIT(message, client_->GetReceivedData(), kTimeout);
- LOG(LS_INFO) << "Transfer complete.";
+ RTC_LOG(LS_INFO) << "Transfer complete.";
}
protected:
diff --git a/rtc_base/sslfingerprint.cc b/rtc_base/sslfingerprint.cc
index 3f4555b..dda46f1 100644
--- a/rtc_base/sslfingerprint.cc
+++ b/rtc_base/sslfingerprint.cc
@@ -67,14 +67,15 @@
const RTCCertificate* cert) {
std::string digest_alg;
if (!cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_alg)) {
- LOG(LS_ERROR) << "Failed to retrieve the certificate's digest algorithm";
+ RTC_LOG(LS_ERROR)
+ << "Failed to retrieve the certificate's digest algorithm";
return nullptr;
}
SSLFingerprint* fingerprint = Create(digest_alg, cert->identity());
if (!fingerprint) {
- LOG(LS_ERROR) << "Failed to create identity fingerprint, alg="
- << digest_alg;
+ RTC_LOG(LS_ERROR) << "Failed to create identity fingerprint, alg="
+ << digest_alg;
}
return fingerprint;
}
diff --git a/rtc_base/sslidentity_unittest.cc b/rtc_base/sslidentity_unittest.cc
index 6932298..c26d8d7 100644
--- a/rtc_base/sslidentity_unittest.cc
+++ b/rtc_base/sslidentity_unittest.cc
@@ -563,7 +563,7 @@
memcpy(buf, entry.string, length); // Copy the ASN1 string...
buf[length] = rtc::CreateRandomId(); // ...and terminate it with junk.
int64_t res = rtc::ASN1TimeToSec(buf, length, entry.long_format);
- LOG(LS_VERBOSE) << entry.string;
+ RTC_LOG(LS_VERBOSE) << entry.string;
ASSERT_EQ(entry.want, res);
}
// Run all examples again, but with an invalid length.
@@ -572,7 +572,7 @@
memcpy(buf, entry.string, length); // Copy the ASN1 string...
buf[length] = rtc::CreateRandomId(); // ...and terminate it with junk.
int64_t res = rtc::ASN1TimeToSec(buf, length - 1, entry.long_format);
- LOG(LS_VERBOSE) << entry.string;
+ RTC_LOG(LS_VERBOSE) << entry.string;
ASSERT_EQ(-1, res);
}
}
diff --git a/rtc_base/sslstreamadapter_unittest.cc b/rtc_base/sslstreamadapter_unittest.cc
index 3999ac5..2a3af85 100644
--- a/rtc_base/sslstreamadapter_unittest.cc
+++ b/rtc_base/sslstreamadapter_unittest.cc
@@ -107,8 +107,8 @@
int mask = (rtc::SE_READ | rtc::SE_CLOSE);
if (sig & mask) {
- LOG(LS_VERBOSE) << "SSLDummyStreamBase::OnEvent side=" << side_
- << " sig=" << sig << " forwarding upward";
+ RTC_LOG(LS_VERBOSE) << "SSLDummyStreamBase::OnEvent side=" << side_
+ << " sig=" << sig << " forwarding upward";
PostEvent(sig & mask, 0);
}
}
@@ -116,8 +116,8 @@
// Catch writeability events on out and pass them up.
void OnEventOut(rtc::StreamInterface* stream, int sig, int err) {
if (sig & rtc::SE_WRITE) {
- LOG(LS_VERBOSE) << "SSLDummyStreamBase::OnEvent side=" << side_
- << " sig=" << sig << " forwarding upward";
+ RTC_LOG(LS_VERBOSE) << "SSLDummyStreamBase::OnEvent side=" << side_
+ << " sig=" << sig << " forwarding upward";
PostEvent(sig & rtc::SE_WRITE, 0);
}
@@ -133,7 +133,7 @@
size_t* written, int* error) override;
void Close() override {
- LOG(LS_INFO) << "Closing outbound stream";
+ RTC_LOG(LS_INFO) << "Closing outbound stream";
out_->Close();
}
@@ -308,7 +308,7 @@
}
virtual void OnEvent(rtc::StreamInterface *stream, int sig, int err) {
- LOG(LS_VERBOSE) << "SSLStreamAdapterTestBase::OnEvent sig=" << sig;
+ RTC_LOG(LS_VERBOSE) << "SSLStreamAdapterTestBase::OnEvent sig=" << sig;
if (sig & rtc::SE_READ) {
ReadData(stream);
@@ -331,7 +331,7 @@
? rtc::SSLPeerCertificateDigestError::NONE
: rtc::SSLPeerCertificateDigestError::VERIFICATION_FAILED;
- LOG(LS_INFO) << "Setting peer identities by digest";
+ RTC_LOG(LS_INFO) << "Setting peer identities by digest";
rv = server_identity_->certificate().ComputeDigest(
rtc::DIGEST_SHA_1, server_digest, 20, &server_digest_len);
@@ -341,7 +341,7 @@
ASSERT_TRUE(rv);
if (!correct) {
- LOG(LS_INFO) << "Setting bogus digest for server cert";
+ RTC_LOG(LS_INFO) << "Setting bogus digest for server cert";
server_digest[0]++;
}
rv = client_ssl_->SetPeerCertificateDigest(rtc::DIGEST_SHA_1, server_digest,
@@ -350,7 +350,7 @@
EXPECT_EQ(expect_success, rv);
if (!correct) {
- LOG(LS_INFO) << "Setting bogus digest for client cert";
+ RTC_LOG(LS_INFO) << "Setting bogus digest for client cert";
client_digest[0]++;
}
rv = server_ssl_->SetPeerCertificateDigest(rtc::DIGEST_SHA_1, client_digest,
@@ -464,12 +464,12 @@
int *error) {
// Randomly drop loss_ percent of packets
if (rtc::CreateRandomId() % 100 < static_cast<uint32_t>(loss_)) {
- LOG(LS_VERBOSE) << "Randomly dropping packet, size=" << data_len;
+ RTC_LOG(LS_VERBOSE) << "Randomly dropping packet, size=" << data_len;
*written = data_len;
return rtc::SR_SUCCESS;
}
if (dtls_ && (data_len > mtu_)) {
- LOG(LS_VERBOSE) << "Dropping packet > mtu, size=" << data_len;
+ RTC_LOG(LS_VERBOSE) << "Dropping packet > mtu, size=" << data_len;
*written = data_len;
return rtc::SR_SUCCESS;
}
@@ -480,7 +480,7 @@
if (damage_ && (*static_cast<const unsigned char *>(data) == 23)) {
std::vector<char> buf(data_len);
- LOG(LS_VERBOSE) << "Damaging packet";
+ RTC_LOG(LS_VERBOSE) << "Damaging packet";
memcpy(&buf[0], data, data_len);
buf[data_len - 1]++;
@@ -620,7 +620,7 @@
// Test data transfer for TLS
void TestTransfer(int size) override {
- LOG(LS_INFO) << "Starting transfer test with " << size << " bytes";
+ RTC_LOG(LS_INFO) << "Starting transfer test with " << size << " bytes";
// Create some dummy data to send.
size_t received;
@@ -666,9 +666,9 @@
if (rv == rtc::SR_SUCCESS) {
send_stream_.SetPosition(position + sent);
- LOG(LS_VERBOSE) << "Sent: " << position + sent;
+ RTC_LOG(LS_VERBOSE) << "Sent: " << position + sent;
} else if (rv == rtc::SR_BLOCK) {
- LOG(LS_VERBOSE) << "Blocked...";
+ RTC_LOG(LS_VERBOSE) << "Blocked...";
send_stream_.SetPosition(position);
break;
} else {
@@ -677,7 +677,7 @@
}
} else {
// Now close
- LOG(LS_INFO) << "Wrote " << position << " bytes. Closing";
+ RTC_LOG(LS_INFO) << "Wrote " << position << " bytes. Closing";
client_ssl_->Close();
break;
}
@@ -704,7 +704,7 @@
break;
ASSERT_EQ(rtc::SR_SUCCESS, r);
- LOG(LS_VERBOSE) << "Read " << bread;
+ RTC_LOG(LS_VERBOSE) << "Read " << bread;
recv_stream_.Write(buffer, bread, nullptr, nullptr);
}
@@ -763,10 +763,10 @@
size_t sent;
rtc::StreamResult rv = client_ssl_->Write(packet, packet_size_, &sent, 0);
if (rv == rtc::SR_SUCCESS) {
- LOG(LS_VERBOSE) << "Sent: " << sent_;
+ RTC_LOG(LS_VERBOSE) << "Sent: " << sent_;
sent_++;
} else if (rv == rtc::SR_BLOCK) {
- LOG(LS_VERBOSE) << "Blocked...";
+ RTC_LOG(LS_VERBOSE) << "Blocked...";
break;
} else {
ADD_FAILURE();
@@ -797,7 +797,7 @@
break;
ASSERT_EQ(rtc::SR_SUCCESS, r);
- LOG(LS_VERBOSE) << "Read " << bread;
+ RTC_LOG(LS_VERBOSE) << "Read " << bread;
// Now parse the datagram
ASSERT_EQ(packet_size_, bread);
@@ -819,7 +819,7 @@
WriteData();
EXPECT_TRUE_WAIT(sent_ == count_, 10000);
- LOG(LS_INFO) << "sent_ == " << sent_;
+ RTC_LOG(LS_INFO) << "sent_ == " << sent_;
if (damage_) {
WAIT(false, 2000);
@@ -827,8 +827,8 @@
} else if (loss_ == 0) {
EXPECT_EQ_WAIT(static_cast<size_t>(sent_), received_.size(), 1000);
} else {
- LOG(LS_INFO) << "Sent " << sent_ << " packets; received " <<
- received_.size();
+ RTC_LOG(LS_INFO) << "Sent " << sent_ << " packets; received "
+ << received_.size();
}
};
@@ -844,12 +844,12 @@
rtc::StreamResult SSLDummyStreamBase::Write(const void* data, size_t data_len,
size_t* written, int* error) {
- LOG(LS_VERBOSE) << "Writing to loopback " << data_len;
+ RTC_LOG(LS_VERBOSE) << "Writing to loopback " << data_len;
if (first_packet_) {
first_packet_ = false;
if (test_base_->GetLoseFirstPacket()) {
- LOG(LS_INFO) << "Losing initial packet of length " << data_len;
+ RTC_LOG(LS_INFO) << "Losing initial packet of length " << data_len;
*written = data_len; // Fake successful writing also to writer.
return rtc::SR_SUCCESS;
}
diff --git a/rtc_base/stream.cc b/rtc_base/stream.cc
index f64b32d..c762277 100644
--- a/rtc_base/stream.cc
+++ b/rtc_base/stream.cc
@@ -931,17 +931,17 @@
void LoggingAdapter::Close() {
LogMultiline(level_, label_.c_str(), false, nullptr, 0, hex_mode_, &lms_);
LogMultiline(level_, label_.c_str(), true, nullptr, 0, hex_mode_, &lms_);
- LOG_V(level_) << label_ << " Closed locally";
+ RTC_LOG_V(level_) << label_ << " Closed locally";
StreamAdapterInterface::Close();
}
void LoggingAdapter::OnEvent(StreamInterface* stream, int events, int err) {
if (events & SE_OPEN) {
- LOG_V(level_) << label_ << " Open";
+ RTC_LOG_V(level_) << label_ << " Open";
} else if (events & SE_CLOSE) {
LogMultiline(level_, label_.c_str(), false, nullptr, 0, hex_mode_, &lms_);
LogMultiline(level_, label_.c_str(), true, nullptr, 0, hex_mode_, &lms_);
- LOG_V(level_) << label_ << " Closed with error: " << err;
+ RTC_LOG_V(level_) << label_ << " Closed with error: " << err;
}
StreamAdapterInterface::OnEvent(stream, events, err);
}
diff --git a/rtc_base/task_queue.h b/rtc_base/task_queue.h
index 7842ea3..2f247e6 100644
--- a/rtc_base/task_queue.h
+++ b/rtc_base/task_queue.h
@@ -119,7 +119,7 @@
// }
// ...
// my_class->StartWorkAndLetMeKnowWhenDone(
-// NewClosure([]() { LOG(INFO) << "The work is done!";}));
+// NewClosure([]() { RTC_LOG(INFO) << "The work is done!";}));
//
// 3) Posting a custom task on a timer. The task posts itself again after
// every running:
diff --git a/rtc_base/task_queue_libevent.cc b/rtc_base/task_queue_libevent.cc
index 3d9188e..eb242b6 100644
--- a/rtc_base/task_queue_libevent.cc
+++ b/rtc_base/task_queue_libevent.cc
@@ -358,7 +358,7 @@
}
char message = kRunTask;
if (write(wakeup_pipe_in_, &message, sizeof(message)) != sizeof(message)) {
- LOG(WARNING) << "Failed to queue task.";
+ RTC_LOG(WARNING) << "Failed to queue task.";
CritScope lock(&pending_lock_);
pending_.remove_if([task_id](std::unique_ptr<QueuedTask>& t) {
return t.get() == task_id;
diff --git a/rtc_base/testclient_unittest.cc b/rtc_base/testclient_unittest.cc
index f3c8561..1d1d3f2 100644
--- a/rtc_base/testclient_unittest.cc
+++ b/rtc_base/testclient_unittest.cc
@@ -18,16 +18,16 @@
using namespace rtc;
-#define MAYBE_SKIP_IPV4 \
- if (!HasIPv4Enabled()) { \
- LOG(LS_INFO) << "No IPv4... skipping"; \
- return; \
+#define MAYBE_SKIP_IPV4 \
+ if (!HasIPv4Enabled()) { \
+ RTC_LOG(LS_INFO) << "No IPv4... skipping"; \
+ return; \
}
-#define MAYBE_SKIP_IPV6 \
- if (!HasIPv6Enabled()) { \
- LOG(LS_INFO) << "No IPv6... skipping"; \
- return; \
+#define MAYBE_SKIP_IPV6 \
+ if (!HasIPv6Enabled()) { \
+ RTC_LOG(LS_INFO) << "No IPv6... skipping"; \
+ return; \
}
void TestUdpInternal(const SocketAddress& loopback) {
diff --git a/rtc_base/testutils.h b/rtc_base/testutils.h
index a3ced7c..d901f82 100644
--- a/rtc_base/testutils.h
+++ b/rtc_base/testutils.h
@@ -471,12 +471,13 @@
// Helpers for determining if X/screencasting is available (on linux).
-#define MAYBE_SKIP_SCREENCAST_TEST() \
- if (!testing::IsScreencastingAvailable()) { \
- LOG(LS_WARNING) << "Skipping test, since it doesn't have the requisite " \
- << "X environment for screen capture."; \
- return; \
- } \
+#define MAYBE_SKIP_SCREENCAST_TEST() \
+ if (!testing::IsScreencastingAvailable()) { \
+ RTC_LOG(LS_WARNING) \
+ << "Skipping test, since it doesn't have the requisite " \
+ << "X environment for screen capture."; \
+ return; \
+ }
#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
struct XDisplay {
@@ -495,18 +496,18 @@
#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
XDisplay display;
if (!display.IsValid()) {
- LOG(LS_WARNING) << "No X Display available.";
+ RTC_LOG(LS_WARNING) << "No X Display available.";
return false;
}
int ignored_int, major_version, minor_version;
if (!XRRQueryExtension(display, &ignored_int, &ignored_int) ||
!XRRQueryVersion(display, &major_version, &minor_version)) {
- LOG(LS_WARNING) << "XRandr is not supported.";
+ RTC_LOG(LS_WARNING) << "XRandr is not supported.";
return false;
}
if (major_version < 1 || (major_version < 2 && minor_version < 3)) {
- LOG(LS_WARNING) << "XRandr is too old (version: " << major_version << "."
- << minor_version << "). Need 1.3 or later.";
+ RTC_LOG(LS_WARNING) << "XRandr is too old (version: " << major_version
+ << "." << minor_version << "). Need 1.3 or later.";
return false;
}
#endif
diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc
index 41ba04e..6dda762 100644
--- a/rtc_base/thread.cc
+++ b/rtc_base/thread.cc
@@ -176,7 +176,7 @@
ts.tv_nsec = (milliseconds % 1000) * 1000000;
int ret = nanosleep(&ts, nullptr);
if (ret != 0) {
- LOG_ERR(LS_WARNING) << "nanosleep() returning early";
+ RTC_LOG_ERR(LS_WARNING) << "nanosleep() returning early";
return false;
}
return true;
@@ -222,7 +222,7 @@
int error_code = pthread_create(&thread_, &attr, PreRun, init);
if (0 != error_code) {
- LOG(LS_ERROR) << "Unable to create pthread, error " << error_code;
+ RTC_LOG(LS_ERROR) << "Unable to create pthread, error " << error_code;
return false;
}
running_.Set();
@@ -240,7 +240,8 @@
#if defined(WEBRTC_WIN)
if (thread_ != nullptr) {
if (!CloseHandle(thread_)) {
- LOG_GLE(LS_ERROR) << "When unwrapping thread, failed to close handle.";
+ RTC_LOG_GLE(LS_ERROR)
+ << "When unwrapping thread, failed to close handle.";
}
thread_ = nullptr;
}
@@ -256,8 +257,8 @@
if (running()) {
RTC_DCHECK(!IsCurrent());
if (Current() && !Current()->blocking_calls_allowed_) {
- LOG(LS_WARNING) << "Waiting for the thread to join, "
- << "but blocking calls have been disallowed";
+ RTC_LOG(LS_WARNING) << "Waiting for the thread to join, "
+ << "but blocking calls have been disallowed";
}
#if defined(WEBRTC_WIN)
@@ -506,7 +507,7 @@
// This gives us the best chance of succeeding.
thread_ = OpenThread(SYNCHRONIZE, FALSE, GetCurrentThreadId());
if (!thread_) {
- LOG_GLE(LS_ERROR) << "Unable to get handle to thread.";
+ RTC_LOG_GLE(LS_ERROR) << "Unable to get handle to thread.";
return false;
}
thread_id_ = GetCurrentThreadId();
diff --git a/rtc_base/timestampaligner.cc b/rtc_base/timestampaligner.cc
index 22a4436..a9bcafb 100644
--- a/rtc_base/timestampaligner.cc
+++ b/rtc_base/timestampaligner.cc
@@ -86,9 +86,9 @@
// below this threshold.
static const int64_t kResetThresholdUs = 300000;
if (std::abs(error_us) > kResetThresholdUs) {
- LOG(LS_INFO) << "Resetting timestamp translation after averaging "
- << frames_seen_ << " frames. Old offset: " << offset_us_
- << ", new offset: " << diff_us;
+ RTC_LOG(LS_INFO) << "Resetting timestamp translation after averaging "
+ << frames_seen_ << " frames. Old offset: " << offset_us_
+ << ", new offset: " << diff_us;
frames_seen_ = 0;
clip_bias_us_ = 0;
}
@@ -119,10 +119,10 @@
// timestamps with with too short inter-frame interval. We may even return
// duplicate timestamps in case this function is called several times with
// exactly the same |system_time_us|.
- LOG(LS_WARNING) << "too short translated timestamp interval: "
- << "system time (us) = " << system_time_us
- << ", interval (us) = "
- << system_time_us - prev_translated_time_us_;
+ RTC_LOG(LS_WARNING) << "too short translated timestamp interval: "
+ << "system time (us) = " << system_time_us
+ << ", interval (us) = "
+ << system_time_us - prev_translated_time_us_;
time_us = system_time_us;
}
}
diff --git a/rtc_base/trace_event.h b/rtc_base/trace_event.h
index 9497a2d..7a9f2dd 100644
--- a/rtc_base/trace_event.h
+++ b/rtc_base/trace_event.h
@@ -28,7 +28,7 @@
// Begin and end of function calls
// Counters
//
-// Events are issued against categories. Whereas LOG's
+// Events are issued against categories. Whereas RTC_LOG's
// categories are statically defined, TRACE categories are created
// implicitly with a string. For example:
// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
@@ -141,7 +141,6 @@
// Thread safety is provided by methods defined in event_tracer.h. See the file
// for details.
-
// By default, const char* argument values are assumed to have long-lived scope
// and will not be copied. Use this macro to force a const char* to be copied.
#define TRACE_STR_COPY(str) \
diff --git a/rtc_base/unittest_main.cc b/rtc_base/unittest_main.cc
index dd294c2..cff32ef 100644
--- a/rtc_base/unittest_main.cc
+++ b/rtc_base/unittest_main.cc
@@ -44,18 +44,20 @@
const wchar_t* file,
unsigned int line,
uintptr_t pReserved) {
- LOG(LS_ERROR) << "InvalidParameter Handler called. Exiting.";
- LOG(LS_ERROR) << expression << std::endl << function << std::endl << file
- << std::endl << line;
+ RTC_LOG(LS_ERROR) << "InvalidParameter Handler called. Exiting.";
+ RTC_LOG(LS_ERROR) << expression << std::endl
+ << function << std::endl
+ << file << std::endl
+ << line;
exit(1);
}
void TestPureCallHandler() {
- LOG(LS_ERROR) << "Purecall Handler called. Exiting.";
+ RTC_LOG(LS_ERROR) << "Purecall Handler called. Exiting.";
exit(1);
}
int TestCrtReportHandler(int report_type, char* msg, int* retval) {
- LOG(LS_ERROR) << "CrtReport Handler called...";
- LOG(LS_ERROR) << msg;
+ RTC_LOG(LS_ERROR) << "CrtReport Handler called...";
+ RTC_LOG(LS_ERROR) << msg;
if (report_type == _CRT_ASSERT) {
exit(1);
} else {
diff --git a/rtc_base/unixfilesystem.cc b/rtc_base/unixfilesystem.cc
index 8355141..8732d47 100644
--- a/rtc_base/unixfilesystem.cc
+++ b/rtc_base/unixfilesystem.cc
@@ -58,7 +58,7 @@
UnixFilesystem::~UnixFilesystem() {}
bool UnixFilesystem::DeleteFile(const Pathname &filename) {
- LOG(LS_INFO) << "Deleting file:" << filename.pathname();
+ RTC_LOG(LS_INFO) << "Deleting file:" << filename.pathname();
if (!IsFile(filename)) {
RTC_DCHECK(IsFile(filename));
@@ -89,8 +89,8 @@
RTC_DCHECK(IsFile(old_path));
return false;
}
- LOG(LS_VERBOSE) << "Moving " << old_path.pathname()
- << " to " << new_path.pathname();
+ RTC_LOG(LS_VERBOSE) << "Moving " << old_path.pathname() << " to "
+ << new_path.pathname();
if (rename(old_path.pathname().c_str(), new_path.pathname().c_str()) != 0) {
return false;
}
diff --git a/rtc_base/virtualsocket_unittest.cc b/rtc_base/virtualsocket_unittest.cc
index 6081346..a6a4ee1 100644
--- a/rtc_base/virtualsocket_unittest.cc
+++ b/rtc_base/virtualsocket_unittest.cc
@@ -707,7 +707,7 @@
// address.
void DelayTest(const SocketAddress& initial_addr) {
time_t seed = ::time(nullptr);
- LOG(LS_VERBOSE) << "seed = " << seed;
+ RTC_LOG(LS_VERBOSE) << "seed = " << seed;
srand(static_cast<unsigned int>(seed));
const uint32_t mean = 2000;
@@ -744,7 +744,8 @@
receiver.samples * receiver.sum_sq - receiver.sum * receiver.sum;
double den = receiver.samples * (receiver.samples - 1);
const double sample_stddev = sqrt(num / den);
- LOG(LS_VERBOSE) << "mean=" << sample_mean << " stddev=" << sample_stddev;
+ RTC_LOG(LS_VERBOSE) << "mean=" << sample_mean
+ << " stddev=" << sample_stddev;
EXPECT_LE(500u, receiver.samples);
// We initially used a 0.1 fudge factor, but on the build machine, we
diff --git a/rtc_base/virtualsocketserver.cc b/rtc_base/virtualsocketserver.cc
index e799cea..d461bf1 100644
--- a/rtc_base/virtualsocketserver.cc
+++ b/rtc_base/virtualsocketserver.cc
@@ -409,7 +409,7 @@
} else if ((SOCK_STREAM == type_) && (CS_CONNECTING == state_)) {
CompleteConnect(data->addr, true);
} else {
- LOG(LS_VERBOSE) << "Socket at " << local_addr_ << " is not listening";
+ RTC_LOG(LS_VERBOSE) << "Socket at " << local_addr_ << " is not listening";
server_->Disconnect(server_->LookupBinding(data->addr));
}
delete data;
@@ -804,8 +804,8 @@
uint32_t delay = use_delay ? GetTransitDelay(socket) : 0;
VirtualSocket* remote = LookupBinding(remote_addr);
if (!CanInteractWith(socket, remote)) {
- LOG(LS_INFO) << "Address family mismatch between "
- << socket->GetLocalAddress() << " and " << remote_addr;
+ RTC_LOG(LS_INFO) << "Address family mismatch between "
+ << socket->GetLocalAddress() << " and " << remote_addr;
return -1;
}
if (remote != nullptr) {
@@ -813,7 +813,7 @@
msg_queue_->PostDelayed(RTC_FROM_HERE, delay, remote, MSG_ID_CONNECT,
new MessageAddress(addr));
} else {
- LOG(LS_INFO) << "No one listening at " << remote_addr;
+ RTC_LOG(LS_INFO) << "No one listening at " << remote_addr;
msg_queue_->PostDelayed(RTC_FROM_HERE, delay, socket, MSG_ID_DISCONNECT);
}
return 0;
@@ -843,7 +843,7 @@
// See if we want to drop this packet.
if (Random() < drop_prob_) {
- LOG(LS_VERBOSE) << "Dropping packet: bad luck";
+ RTC_LOG(LS_VERBOSE) << "Dropping packet: bad luck";
return static_cast<int>(data_size);
}
@@ -854,17 +854,18 @@
CreateSocketInternal(AF_INET, SOCK_DGRAM));
dummy_socket->SetLocalAddress(remote_addr);
if (!CanInteractWith(socket, dummy_socket.get())) {
- LOG(LS_VERBOSE) << "Incompatible address families: "
- << socket->GetLocalAddress() << " and " << remote_addr;
+ RTC_LOG(LS_VERBOSE) << "Incompatible address families: "
+ << socket->GetLocalAddress() << " and "
+ << remote_addr;
return -1;
}
- LOG(LS_VERBOSE) << "No one listening at " << remote_addr;
+ RTC_LOG(LS_VERBOSE) << "No one listening at " << remote_addr;
return static_cast<int>(data_size);
}
if (!CanInteractWith(socket, recipient)) {
- LOG(LS_VERBOSE) << "Incompatible address families: "
- << socket->GetLocalAddress() << " and " << remote_addr;
+ RTC_LOG(LS_VERBOSE) << "Incompatible address families: "
+ << socket->GetLocalAddress() << " and " << remote_addr;
return -1;
}
@@ -884,7 +885,7 @@
size_t packet_size = data_size + UDP_HEADER_SIZE;
if (socket->network_size_ + packet_size > network_capacity_) {
- LOG(LS_VERBOSE) << "Dropping packet: network capacity exceeded";
+ RTC_LOG(LS_VERBOSE) << "Dropping packet: network capacity exceeded";
return static_cast<int>(data_size);
}
@@ -912,7 +913,7 @@
VirtualSocket* recipient = LookupConnection(socket->local_addr_,
socket->remote_addr_);
if (!recipient) {
- LOG(LS_VERBOSE) << "Sending data to no one.";
+ RTC_LOG(LS_VERBOSE) << "Sending data to no one.";
return;
}
@@ -1088,7 +1089,7 @@
// Otherwise, use the delay from the distribution distribution.
size_t index = rand() % delay_dist_->size();
double delay = (*delay_dist_)[index].second;
- // LOG_F(LS_INFO) << "random[" << index << "] = " << delay;
+ // RTC_LOG_F(LS_INFO) << "random[" << index << "] = " << delay;
return static_cast<uint32_t>(delay);
}
diff --git a/rtc_base/win32filesystem.cc b/rtc_base/win32filesystem.cc
index 024aa84..511f966 100644
--- a/rtc_base/win32filesystem.cc
+++ b/rtc_base/win32filesystem.cc
@@ -34,7 +34,7 @@
namespace rtc {
bool Win32Filesystem::DeleteFile(const Pathname &filename) {
- LOG(LS_INFO) << "Deleting file " << filename.pathname();
+ RTC_LOG(LS_INFO) << "Deleting file " << filename.pathname();
if (!IsFile(filename)) {
RTC_DCHECK(IsFile(filename));
return false;
@@ -58,8 +58,8 @@
RTC_DCHECK(IsFile(old_path));
return false;
}
- LOG(LS_INFO) << "Moving " << old_path.pathname()
- << " to " << new_path.pathname();
+ RTC_LOG(LS_INFO) << "Moving " << old_path.pathname() << " to "
+ << new_path.pathname();
return ::MoveFile(ToUtf16(old_path.pathname()).c_str(),
ToUtf16(new_path.pathname()).c_str()) != 0;
}
diff --git a/rtc_base/win32socketserver.cc b/rtc_base/win32socketserver.cc
index 72d352d..d79a1b3 100644
--- a/rtc_base/win32socketserver.cc
+++ b/rtc_base/win32socketserver.cc
@@ -125,9 +125,8 @@
void ReportWSAError(LPCSTR context, int error, const SocketAddress& address) {
LPCSTR description_string;
LPCSTR error_string = WSAErrorToString(error, &description_string);
- LOG(LS_INFO) << context << " = " << error
- << " (" << error_string << ":" << description_string << ") ["
- << address.ToString() << "]";
+ RTC_LOG(LS_INFO) << context << " = " << error << " (" << error_string << ":"
+ << description_string << ") [" << address.ToString() << "]";
}
#else
void ReportWSAError(LPCSTR context, int error, const SocketAddress& address) {}
@@ -216,8 +215,8 @@
void Win32Socket::EventSink::OnNcDestroy() {
if (parent_) {
- LOG(LS_ERROR) << "EventSink hwnd is being destroyed, but the event sink"
- " hasn't yet been disposed.";
+ RTC_LOG(LS_ERROR) << "EventSink hwnd is being destroyed, but the event sink"
+ " hasn't yet been disposed.";
} else {
delete this;
}
@@ -287,8 +286,8 @@
if (result >= 0) {
SocketAddressFromSockAddrStorage(addr, &address);
} else {
- LOG(LS_WARNING) << "GetLocalAddress: unable to get local addr, socket="
- << socket_;
+ RTC_LOG(LS_WARNING) << "GetLocalAddress: unable to get local addr, socket="
+ << socket_;
}
return address;
}
@@ -302,8 +301,8 @@
if (result >= 0) {
SocketAddressFromSockAddrStorage(addr, &address);
} else {
- LOG(LS_WARNING) << "GetRemoteAddress: unable to get remote addr, socket="
- << socket_;
+ RTC_LOG(LS_WARNING)
+ << "GetRemoteAddress: unable to get remote addr, socket=" << socket_;
}
return address;
}
@@ -332,7 +331,7 @@
return DoConnect(addr);
}
- LOG_F(LS_INFO) << "async dns lookup (" << addr.hostname() << ")";
+ RTC_LOG_F(LS_INFO) << "async dns lookup (" << addr.hostname() << ")";
DnsLookup * dns = new DnsLookup;
if (!sink_) {
// Explicitly create the sink ourselves here; we can't rely on SetAsync
@@ -345,7 +344,7 @@
sizeof(dns->buffer));
if (!dns->handle) {
- LOG_F(LS_ERROR) << "WSAAsyncGetHostByName error: " << WSAGetLastError();
+ RTC_LOG_F(LS_ERROR) << "WSAAsyncGetHostByName error: " << WSAGetLastError();
delete dns;
UpdateLastError();
Close();
@@ -590,7 +589,7 @@
*sopt = TCP_NODELAY;
break;
case OPT_DSCP:
- LOG(LS_WARNING) << "Socket::OPT_DSCP not supported.";
+ RTC_LOG(LS_WARNING) << "Socket::OPT_DSCP not supported.";
return -1;
default:
RTC_NOTREACHED();
@@ -611,8 +610,8 @@
ReportWSAError("WSAAsync:connect notify", error, addr_);
#if !defined(NDEBUG)
int64_t duration = TimeSince(connect_time_);
- LOG(LS_INFO) << "WSAAsync:connect error (" << duration
- << " ms), faking close";
+ RTC_LOG(LS_INFO) << "WSAAsync:connect error (" << duration
+ << " ms), faking close";
#endif
state_ = CS_CLOSED;
// If you get an error connecting, close doesn't really do anything
@@ -624,7 +623,7 @@
} else {
#if !defined(NDEBUG)
int64_t duration = TimeSince(connect_time_);
- LOG(LS_INFO) << "WSAAsync:connect (" << duration << " ms)";
+ RTC_LOG(LS_INFO) << "WSAAsync:connect (" << duration << " ms)";
#endif
state_ = CS_CONNECTED;
SignalConnectEvent(this);
@@ -669,8 +668,8 @@
ip = NetworkToHost32(net_ip);
}
- LOG_F(LS_INFO) << "(" << IPAddress(ip).ToSensitiveString()
- << ", " << error << ")";
+ RTC_LOG_F(LS_INFO) << "(" << IPAddress(ip).ToSensitiveString() << ", "
+ << error << ")";
if (error == 0) {
SocketAddress address(ip, dns_->port);
@@ -703,7 +702,7 @@
if (s_wm_wakeup_id == 0)
s_wm_wakeup_id = RegisterWindowMessage(L"WM_WAKEUP");
if (!wnd_.Create(nullptr, kWindowName, 0, 0, 0, 0, 0, 0)) {
- LOG_GLE(LS_ERROR) << "Failed to create message window.";
+ RTC_LOG_GLE(LS_ERROR) << "Failed to create message window.";
}
}
@@ -754,7 +753,7 @@
// Otherwise, dispatch as usual via Translate/DispatchMessage.
b = GetMessage(&msg, nullptr, 0, 0);
if (b == -1) {
- LOG_GLE(LS_ERROR) << "GetMessage failed.";
+ RTC_LOG_GLE(LS_ERROR) << "GetMessage failed.";
return false;
} else if(b) {
if (!hdlg_ || !IsDialogMessage(hdlg_, &msg)) {
diff --git a/rtc_base/win32window.cc b/rtc_base/win32window.cc
index 9e9c839..d71c68e 100644
--- a/rtc_base/win32window.cc
+++ b/rtc_base/win32window.cc
@@ -40,7 +40,7 @@
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCWSTR>(&Win32Window::WndProc),
&instance_)) {
- LOG_GLE(LS_ERROR) << "GetModuleHandleEx failed";
+ RTC_LOG_GLE(LS_ERROR) << "GetModuleHandleEx failed";
return false;
}
@@ -53,7 +53,7 @@
wcex.lpszClassName = kWindowBaseClassName;
window_class_ = ::RegisterClassEx(&wcex);
if (!window_class_) {
- LOG_GLE(LS_ERROR) << "RegisterClassEx failed";
+ RTC_LOG_GLE(LS_ERROR) << "RegisterClassEx failed";
return false;
}
}
@@ -113,7 +113,7 @@
if (WM_DESTROY == uMsg) {
for (HWND child = ::GetWindow(hwnd, GW_CHILD); child;
child = ::GetWindow(child, GW_HWNDNEXT)) {
- LOG(LS_INFO) << "Child window: " << static_cast<void*>(child);
+ RTC_LOG(LS_INFO) << "Child window: " << static_cast<void*>(child);
}
}
if (WM_NCDESTROY == uMsg) {