Revert "Some cleanup for the logging code:"

This reverts commit 9ecdcdf2b527bdb1d097782d92817c9866d6d18b.

Reason for revert: Breaks downstream project.

Original change's description:
> Some cleanup for the logging code:
> 
> * Only include 'tag' for Android. Before there was an
>   extra std::string variable per log statement for all
>   platforms.
> * Remove unused logging macro for Windows and 'module' ctor argument.
> * Move httpcommon code out of logging and to where it's used.
> 
> Change-Id: I347805d3df2cee2840c0d2eef5bfefaff1cdbf37
> Bug: webrtc:8928
> Reviewed-on: https://webrtc-review.googlesource.com/57183
> Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22184}

TBR=kwiberg@webrtc.org,tommi@webrtc.org,jonasolsson@webrtc.org

Change-Id: I37a13d766fbdee2adb7f45231cf8be6b2b456bec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8928
Reviewed-on: https://webrtc-review.googlesource.com/57720
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22187}
This commit is contained in:
Philip Eliasson 2018-02-26 14:54:45 +00:00 committed by Commit Bot
parent 9e24cb344a
commit 278aa42718
7 changed files with 155 additions and 123 deletions

View File

@ -764,6 +764,7 @@ rtc_static_library("rtc_base_generic") {
"win32.h", "win32.h",
"win32filesystem.cc", "win32filesystem.cc",
"win32filesystem.h", "win32filesystem.h",
"win32securityerrors.cc",
"win32window.cc", "win32window.cc",
"win32window.h", "win32window.h",
] ]

View File

@ -11,6 +11,7 @@
#include <time.h> #include <time.h>
#if defined(WEBRTC_WIN) #if defined(WEBRTC_WIN)
#define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
@ -30,80 +31,10 @@
#include "rtc_base/socketaddress.h" #include "rtc_base/socketaddress.h"
namespace rtc { namespace rtc {
namespace {
#if defined(WEBRTC_WIN) #if defined(WEBRTC_WIN)
/////////////////////////////////////////////////////////////////////////////// extern const ConstantLabel SECURITY_ERRORS[];
// ConstantToLabel can be used to easily generate string names from constant #endif
// values. This can be useful for logging descriptive names of error messages.
// Usage:
// const ConstantToLabel LIBRARY_ERRORS[] = {
// KLABEL(SOME_ERROR),
// KLABEL(SOME_OTHER_ERROR),
// ...
// LASTLABEL
// }
//
// int err = LibraryFunc();
// LOG(LS_ERROR) << "LibraryFunc returned: "
// << GetErrorName(err, LIBRARY_ERRORS);
struct ConstantToLabel { int value; const char * label; };
const char* LookupLabel(int value, const ConstantToLabel entries[]) {
for (int i = 0; entries[i].label; ++i) {
if (value == entries[i].value) {
return entries[i].label;
}
}
return 0;
}
std::string GetErrorName(int err, const ConstantToLabel* err_table) {
if (err == 0)
return "No error";
if (err_table != 0) {
if (const char* value = LookupLabel(err, err_table))
return value;
}
char buffer[16];
snprintf(buffer, sizeof(buffer), "0x%08x", err);
return buffer;
}
#define KLABEL(x) { x, #x }
#define LASTLABEL { 0, 0 }
const ConstantToLabel SECURITY_ERRORS[] = {
KLABEL(SEC_I_COMPLETE_AND_CONTINUE),
KLABEL(SEC_I_COMPLETE_NEEDED),
KLABEL(SEC_I_CONTEXT_EXPIRED),
KLABEL(SEC_I_CONTINUE_NEEDED),
KLABEL(SEC_I_INCOMPLETE_CREDENTIALS),
KLABEL(SEC_I_RENEGOTIATE),
KLABEL(SEC_E_CERT_EXPIRED),
KLABEL(SEC_E_INCOMPLETE_MESSAGE),
KLABEL(SEC_E_INSUFFICIENT_MEMORY),
KLABEL(SEC_E_INTERNAL_ERROR),
KLABEL(SEC_E_INVALID_HANDLE),
KLABEL(SEC_E_INVALID_TOKEN),
KLABEL(SEC_E_LOGON_DENIED),
KLABEL(SEC_E_NO_AUTHENTICATING_AUTHORITY),
KLABEL(SEC_E_NO_CREDENTIALS),
KLABEL(SEC_E_NOT_OWNER),
KLABEL(SEC_E_OK),
KLABEL(SEC_E_SECPKG_NOT_FOUND),
KLABEL(SEC_E_TARGET_UNKNOWN),
KLABEL(SEC_E_UNKNOWN_CREDENTIALS),
KLABEL(SEC_E_UNSUPPORTED_FUNCTION),
KLABEL(SEC_E_UNTRUSTED_ROOT),
KLABEL(SEC_E_WRONG_PRINCIPAL),
LASTLABEL
};
#undef KLABEL
#undef LASTLABEL
#endif // defined(WEBRTC_WIN)
} // namespace
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Enum - TODO: expose globally later? // Enum - TODO: expose globally later?
@ -934,7 +865,7 @@ HttpAuthResult HttpAuthenticate(
ret = InitializeSecurityContextA(&neg->cred, &neg->ctx, spn, flags, 0, SECURITY_NATIVE_DREP, &in_buf_desc, 0, &neg->ctx, &out_buf_desc, &ret_flags, &lifetime); ret = InitializeSecurityContextA(&neg->cred, &neg->ctx, spn, flags, 0, SECURITY_NATIVE_DREP, &in_buf_desc, 0, &neg->ctx, &out_buf_desc, &ret_flags, &lifetime);
if (FAILED(ret)) { if (FAILED(ret)) {
RTC_LOG(LS_ERROR) << "InitializeSecurityContext returned: " RTC_LOG(LS_ERROR) << "InitializeSecurityContext returned: "
<< GetErrorName(ret, SECURITY_ERRORS); << ErrorName(ret, SECURITY_ERRORS);
return HAR_ERROR; return HAR_ERROR;
} }
} else if (neg->specified_credentials) { } else if (neg->specified_credentials) {
@ -1000,7 +931,7 @@ HttpAuthResult HttpAuthenticate(
SECPKG_CRED_OUTBOUND, 0, pauth_id, 0, 0, &cred, &lifetime); SECPKG_CRED_OUTBOUND, 0, pauth_id, 0, 0, &cred, &lifetime);
if (ret != SEC_E_OK) { if (ret != SEC_E_OK) {
RTC_LOG(LS_ERROR) << "AcquireCredentialsHandle error: " RTC_LOG(LS_ERROR) << "AcquireCredentialsHandle error: "
<< GetErrorName(ret, SECURITY_ERRORS); << ErrorName(ret, SECURITY_ERRORS);
return HAR_IGNORE; return HAR_IGNORE;
} }
@ -1010,7 +941,7 @@ HttpAuthResult HttpAuthenticate(
ret = InitializeSecurityContextA(&cred, 0, spn, flags, 0, SECURITY_NATIVE_DREP, 0, 0, &ctx, &out_buf_desc, &ret_flags, &lifetime); ret = InitializeSecurityContextA(&cred, 0, spn, flags, 0, SECURITY_NATIVE_DREP, 0, 0, &ctx, &out_buf_desc, &ret_flags, &lifetime);
if (FAILED(ret)) { if (FAILED(ret)) {
RTC_LOG(LS_ERROR) << "InitializeSecurityContext returned: " RTC_LOG(LS_ERROR) << "InitializeSecurityContext returned: "
<< GetErrorName(ret, SECURITY_ERRORS); << ErrorName(ret, SECURITY_ERRORS);
FreeCredentialsHandle(&cred); FreeCredentialsHandle(&cred);
return HAR_IGNORE; return HAR_IGNORE;
} }
@ -1024,7 +955,7 @@ HttpAuthResult HttpAuthenticate(
if ((ret == SEC_I_COMPLETE_NEEDED) || (ret == SEC_I_COMPLETE_AND_CONTINUE)) { if ((ret == SEC_I_COMPLETE_NEEDED) || (ret == SEC_I_COMPLETE_AND_CONTINUE)) {
ret = CompleteAuthToken(&neg->ctx, &out_buf_desc); ret = CompleteAuthToken(&neg->ctx, &out_buf_desc);
RTC_LOG(LS_VERBOSE) << "CompleteAuthToken returned: " RTC_LOG(LS_VERBOSE) << "CompleteAuthToken returned: "
<< GetErrorName(ret, SECURITY_ERRORS); << ErrorName(ret, SECURITY_ERRORS);
if (FAILED(ret)) { if (FAILED(ret)) {
return HAR_ERROR; return HAR_ERROR;
} }

View File

@ -29,6 +29,8 @@
static const int kMaxLogLineSize = 1024 - 60; static const int kMaxLogLineSize = 1024 - 60;
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID
static const char kLibjingle[] = "libjingle";
#include <time.h> #include <time.h>
#include <limits.h> #include <limits.h>
@ -39,7 +41,7 @@ static const int kMaxLogLineSize = 1024 - 60;
#include "rtc_base/criticalsection.h" #include "rtc_base/criticalsection.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/platform_thread_types.h" #include "rtc_base/platform_thread.h"
#include "rtc_base/stringencode.h" #include "rtc_base/stringencode.h"
#include "rtc_base/stringutils.h" #include "rtc_base/stringutils.h"
#include "rtc_base/timeutils.h" #include "rtc_base/timeutils.h"
@ -69,6 +71,32 @@ const char* FilenameFromPath(const char* file) {
CriticalSection g_log_crit; CriticalSection g_log_crit;
} // namespace } // namespace
/////////////////////////////////////////////////////////////////////////////
// Constant Labels
/////////////////////////////////////////////////////////////////////////////
const char* FindLabel(int value, const ConstantLabel entries[]) {
for (int i = 0; entries[i].label; ++i) {
if (value == entries[i].value) {
return entries[i].label;
}
}
return 0;
}
std::string ErrorName(int err, const ConstantLabel* err_table) {
if (err == 0)
return "No error";
if (err_table != 0) {
if (const char* value = FindLabel(err, err_table))
return value;
}
char buffer[16];
snprintf(buffer, sizeof(buffer), "0x%08x", err);
return buffer;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// LogMessage // LogMessage
@ -89,8 +117,9 @@ LogMessage::LogMessage(const char* file,
int line, int line,
LoggingSeverity sev, LoggingSeverity sev,
LogErrorContext err_ctx, LogErrorContext err_ctx,
int err) int err,
: severity_(sev) { const char* module)
: severity_(sev), tag_(kLibjingle) {
if (timestamp_) { if (timestamp_) {
// Use SystemTimeMillis so that even if tests use fake clocks, the timestamp // Use SystemTimeMillis so that even if tests use fake clocks, the timestamp
// in log messages represents the real system time. // in log messages represents the real system time.
@ -121,10 +150,12 @@ LogMessage::LogMessage(const char* file,
#ifdef WEBRTC_WIN #ifdef WEBRTC_WIN
case ERRCTX_HRESULT: { case ERRCTX_HRESULT: {
char msgbuf[256]; char msgbuf[256];
DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM;
FORMAT_MESSAGE_IGNORE_INSERTS; HMODULE hmod = GetModuleHandleA(module);
if (hmod)
flags |= FORMAT_MESSAGE_FROM_HMODULE;
if (DWORD len = FormatMessageA( if (DWORD len = FormatMessageA(
flags, nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), flags, hmod, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
msgbuf, sizeof(msgbuf) / sizeof(msgbuf[0]), nullptr)) { msgbuf, sizeof(msgbuf) / sizeof(msgbuf[0]), nullptr)) {
while ((len > 0) && while ((len > 0) &&
isspace(static_cast<unsigned char>(msgbuf[len-1]))) { isspace(static_cast<unsigned char>(msgbuf[len-1]))) {
@ -149,20 +180,19 @@ LogMessage::LogMessage(const char* file,
} }
} }
#if defined(WEBRTC_ANDROID)
LogMessage::LogMessage(const char* file, LogMessage::LogMessage(const char* file,
int line, int line,
LoggingSeverity sev, LoggingSeverity sev,
const char* tag) const std::string& tag)
: LogMessage(file, : LogMessage(file,
line, line,
sev, sev,
ERRCTX_NONE, ERRCTX_NONE,
0 /* err */) { 0 /* err */,
nullptr /* module */) {
tag_ = tag; tag_ = tag;
print_stream_ << tag << ": "; print_stream_ << tag << ": ";
} }
#endif
LogMessage::~LogMessage() { LogMessage::~LogMessage() {
if (!extra_.empty()) if (!extra_.empty())
@ -171,11 +201,7 @@ LogMessage::~LogMessage() {
const std::string& str = print_stream_.str(); const std::string& str = print_stream_.str();
if (severity_ >= g_dbg_sev) { if (severity_ >= g_dbg_sev) {
#if defined(WEBRTC_ANDROID)
OutputToDebug(str, severity_, tag_); OutputToDebug(str, severity_, tag_);
#else
OutputToDebug(str, severity_);
#endif
} }
CritScope cs(&g_log_crit); CritScope cs(&g_log_crit);
@ -296,9 +322,20 @@ void LogMessage::ConfigureLogging(const char* params) {
// from the command line, we'll see the output there. Otherwise, create // from the command line, we'll see the output there. Otherwise, create
// our own console window. // our own console window.
// Note: These methods fail if a console already exists, which is fine. // Note: These methods fail if a console already exists, which is fine.
if (!AttachConsole(ATTACH_PARENT_PROCESS)) bool success = false;
typedef BOOL (WINAPI* PFN_AttachConsole)(DWORD);
if (HINSTANCE kernel32 = ::LoadLibrary(L"kernel32.dll")) {
// AttachConsole is defined on WinXP+.
if (PFN_AttachConsole attach_console = reinterpret_cast<PFN_AttachConsole>
(::GetProcAddress(kernel32, "AttachConsole"))) {
success = (FALSE != attach_console(ATTACH_PARENT_PROCESS));
}
::FreeLibrary(kernel32);
}
if (!success) {
::AllocConsole(); ::AllocConsole();
} }
}
#endif // WEBRTC_WIN #endif // WEBRTC_WIN
LogToDebug(debug_level); LogToDebug(debug_level);
@ -313,14 +350,9 @@ void LogMessage::UpdateMinLogSeverity()
g_min_sev = min_sev; g_min_sev = min_sev;
} }
#if defined(WEBRTC_ANDROID)
void LogMessage::OutputToDebug(const std::string& str, void LogMessage::OutputToDebug(const std::string& str,
LoggingSeverity severity, LoggingSeverity severity,
const char* tag) { const std::string& tag) {
#else
void LogMessage::OutputToDebug(const std::string& str,
LoggingSeverity severity) {
#endif
bool log_to_stderr = log_to_stderr_; bool log_to_stderr = log_to_stderr_;
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG) #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG)
// On the Mac, all stderr output goes to the Console log and causes clutter. // On the Mac, all stderr output goes to the Console log and causes clutter.
@ -341,8 +373,7 @@ void LogMessage::OutputToDebug(const std::string& str,
if (key != nullptr) { if (key != nullptr) {
CFRelease(key); CFRelease(key);
} }
#endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG) #endif
#if defined(WEBRTC_WIN) #if defined(WEBRTC_WIN)
// Always log to the debugger. // Always log to the debugger.
// Perhaps stderr should be controlled by a preference, as on Mac? // Perhaps stderr should be controlled by a preference, as on Mac?
@ -357,7 +388,6 @@ void LogMessage::OutputToDebug(const std::string& str,
} }
} }
#endif // WEBRTC_WIN #endif // WEBRTC_WIN
#if defined(WEBRTC_ANDROID) #if defined(WEBRTC_ANDROID)
// Android's logging facility uses severity to log messages but we // Android's logging facility uses severity to log messages but we
// need to map libjingle's severity levels to Android ones first. // need to map libjingle's severity levels to Android ones first.
@ -366,7 +396,7 @@ void LogMessage::OutputToDebug(const std::string& str,
int prio; int prio;
switch (severity) { switch (severity) {
case LS_SENSITIVE: case LS_SENSITIVE:
__android_log_write(ANDROID_LOG_INFO, tag, "SENSITIVE"); __android_log_write(ANDROID_LOG_INFO, tag.c_str(), "SENSITIVE");
if (log_to_stderr) { if (log_to_stderr) {
fprintf(stderr, "SENSITIVE"); fprintf(stderr, "SENSITIVE");
fflush(stderr); fflush(stderr);
@ -393,14 +423,15 @@ void LogMessage::OutputToDebug(const std::string& str,
int idx = 0; int idx = 0;
const int max_lines = size / kMaxLogLineSize + 1; const int max_lines = size / kMaxLogLineSize + 1;
if (max_lines == 1) { if (max_lines == 1) {
__android_log_print(prio, tag, "%.*s", size, str.c_str()); __android_log_print(prio, tag.c_str(), "%.*s", size, str.c_str());
} else { } else {
while (size > 0) { while (size > 0) {
const int len = std::min(size, kMaxLogLineSize); const int len = std::min(size, kMaxLogLineSize);
// Use the size of the string in the format (str may have \0 in the // Use the size of the string in the format (str may have \0 in the
// middle). // middle).
__android_log_print(prio, tag, "[%d/%d] %.*s", line + 1, max_lines, len, __android_log_print(prio, tag.c_str(), "[%d/%d] %.*s",
str.c_str() + idx); line + 1, max_lines,
len, str.c_str() + idx);
idx += len; idx += len;
size -= len; size -= len;
++line; ++line;

View File

@ -26,8 +26,9 @@
// RTC_LOG_F(sev) Like RTC_LOG(), but includes the name of the current function. // RTC_LOG_F(sev) Like RTC_LOG(), but includes the name of the current function.
// RTC_LOG_T(sev) Like RTC_LOG(), but includes the this pointer. // RTC_LOG_T(sev) Like RTC_LOG(), but includes the this pointer.
// RTC_LOG_T_F(sev) Like RTC_LOG_F(), but includes the this pointer. // RTC_LOG_T_F(sev) Like RTC_LOG_F(), but includes the this pointer.
// RTC_LOG_GLE(sev [, mod]) attempt to add a string description of the // RTC_LOG_GLE(M)(sev [, mod]) attempt to add a string description of the
// HRESULT returned by GetLastError. // HRESULT returned by GetLastError. The "M" variant allows searching of a
// DLL's string table for the error description.
// RTC_LOG_ERRNO(sev) attempts to add a string description of an errno-derived // RTC_LOG_ERRNO(sev) attempts to add a string description of an errno-derived
// error. errno and associated facilities exist on both Windows and POSIX, // error. errno and associated facilities exist on both Windows and POSIX,
// but on Windows they only apply to the C/C++ runtime. // but on Windows they only apply to the C/C++ runtime.
@ -67,6 +68,29 @@
namespace rtc { namespace rtc {
///////////////////////////////////////////////////////////////////////////////
// ConstantLabel can be used to easily generate string names from constant
// values. This can be useful for logging descriptive names of error messages.
// Usage:
// const ConstantLabel LIBRARY_ERRORS[] = {
// KLABEL(SOME_ERROR),
// KLABEL(SOME_OTHER_ERROR),
// ...
// LASTLABEL
// }
//
// int err = LibraryFunc();
// LOG(LS_ERROR) << "LibraryFunc returned: "
// << ErrorName(err, LIBRARY_ERRORS);
struct ConstantLabel { int value; const char * label; };
#define KLABEL(x) { x, #x }
#define TLABEL(x, y) { x, y }
#define LASTLABEL { 0, 0 }
const char* FindLabel(int value, const ConstantLabel entries[]);
std::string ErrorName(int err, const ConstantLabel* err_table);
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
// Returns a UTF8 description from an OS X Status error. // Returns a UTF8 description from an OS X Status error.
std::string DescriptionFromOSStatus(OSStatus err); std::string DescriptionFromOSStatus(OSStatus err);
@ -124,11 +148,13 @@ class LogMessage {
int line, int line,
LoggingSeverity sev, LoggingSeverity sev,
LogErrorContext err_ctx = ERRCTX_NONE, LogErrorContext err_ctx = ERRCTX_NONE,
int err = 0); int err = 0,
const char* module = nullptr);
#if defined(WEBRTC_ANDROID) LogMessage(const char* file,
LogMessage(const char* file, int line, LoggingSeverity sev, const char* tag); int line,
#endif LoggingSeverity sev,
const std::string& tag);
~LogMessage(); ~LogMessage();
@ -187,13 +213,9 @@ class LogMessage {
static void UpdateMinLogSeverity(); static void UpdateMinLogSeverity();
// These write out the actual log messages. // These write out the actual log messages.
#if defined(WEBRTC_ANDROID)
static void OutputToDebug(const std::string& msg, static void OutputToDebug(const std::string& msg,
LoggingSeverity severity, LoggingSeverity severity,
const char* tag); const std::string& tag);
#else
static void OutputToDebug(const std::string& msg, LoggingSeverity severity);
#endif
// The ostream that buffers the formatted message before output // The ostream that buffers the formatted message before output
std::ostringstream print_stream_; std::ostringstream print_stream_;
@ -201,10 +223,8 @@ class LogMessage {
// The severity level of this message // The severity level of this message
LoggingSeverity severity_; LoggingSeverity severity_;
#if defined(WEBRTC_ANDROID)
// The Android debug output tag. // The Android debug output tag.
const char* tag_ = "libjingle"; std::string tag_;
#endif
// String data generated in the constructor, that should be appended to // String data generated in the constructor, that should be appended to
// the message before output. // the message before output.
@ -293,6 +313,8 @@ inline bool LogCheckLevel(LoggingSeverity sev) {
RTC_LOG_E(sev, HRESULT, err) RTC_LOG_E(sev, HRESULT, err)
#define RTC_LOG_GLE(sev) \ #define RTC_LOG_GLE(sev) \
RTC_LOG_GLE_EX(sev, GetLastError()) RTC_LOG_GLE_EX(sev, GetLastError())
#define RTC_LOG_GLEM(sev, mod) \
RTC_LOG_E(sev, HRESULT, GetLastError(), mod)
#define RTC_LOG_ERR_EX(sev, err) \ #define RTC_LOG_ERR_EX(sev, err) \
RTC_LOG_GLE_EX(sev, err) RTC_LOG_GLE_EX(sev, err)
#define RTC_LOG_ERR(sev) \ #define RTC_LOG_ERR(sev) \
@ -309,11 +331,9 @@ inline bool LogCheckLevel(LoggingSeverity sev) {
RTC_LOG_ERRNO(sev) RTC_LOG_ERRNO(sev)
#endif // WEBRTC_WIN #endif // WEBRTC_WIN
#if defined(WEBRTC_ANDROID)
#define RTC_LOG_TAG(sev, tag) \ #define RTC_LOG_TAG(sev, tag) \
RTC_LOG_SEVERITY_PRECONDITION(sev) \ RTC_LOG_SEVERITY_PRECONDITION(sev) \
rtc::LogMessage(nullptr, 0, sev, tag).stream() rtc::LogMessage(nullptr, 0, sev, tag).stream()
#endif
// The RTC_DLOG macros are equivalent to their RTC_LOG counterparts except that // The RTC_DLOG macros are equivalent to their RTC_LOG counterparts except that
// they only generate code in debug builds. // they only generate code in debug builds.

View File

@ -16,6 +16,7 @@
#include <errno.h> #include <errno.h>
#if defined(WEBRTC_WIN) #if defined(WEBRTC_WIN)
#define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>

View File

@ -0,0 +1,49 @@
/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/logging.h"
#include "rtc_base/win32.h"
namespace rtc {
///////////////////////////////////////////////////////////////////////////////
extern const ConstantLabel SECURITY_ERRORS[];
const ConstantLabel SECURITY_ERRORS[] = {
KLABEL(SEC_I_COMPLETE_AND_CONTINUE),
KLABEL(SEC_I_COMPLETE_NEEDED),
KLABEL(SEC_I_CONTEXT_EXPIRED),
KLABEL(SEC_I_CONTINUE_NEEDED),
KLABEL(SEC_I_INCOMPLETE_CREDENTIALS),
KLABEL(SEC_I_RENEGOTIATE),
KLABEL(SEC_E_CERT_EXPIRED),
KLABEL(SEC_E_INCOMPLETE_MESSAGE),
KLABEL(SEC_E_INSUFFICIENT_MEMORY),
KLABEL(SEC_E_INTERNAL_ERROR),
KLABEL(SEC_E_INVALID_HANDLE),
KLABEL(SEC_E_INVALID_TOKEN),
KLABEL(SEC_E_LOGON_DENIED),
KLABEL(SEC_E_NO_AUTHENTICATING_AUTHORITY),
KLABEL(SEC_E_NO_CREDENTIALS),
KLABEL(SEC_E_NOT_OWNER),
KLABEL(SEC_E_OK),
KLABEL(SEC_E_SECPKG_NOT_FOUND),
KLABEL(SEC_E_TARGET_UNKNOWN),
KLABEL(SEC_E_UNKNOWN_CREDENTIALS),
KLABEL(SEC_E_UNSUPPORTED_FUNCTION),
KLABEL(SEC_E_UNTRUSTED_ROOT),
KLABEL(SEC_E_WRONG_PRINCIPAL),
LASTLABEL
};
///////////////////////////////////////////////////////////////////////////////
} // namespace rtc

View File

@ -51,8 +51,7 @@ JNI_FUNCTION_DECLARATION(void,
jstring j_message) { jstring j_message) {
std::string message = JavaToStdString(jni, JavaParamRef<jstring>(j_message)); std::string message = JavaToStdString(jni, JavaParamRef<jstring>(j_message));
std::string tag = JavaToStdString(jni, JavaParamRef<jstring>(j_tag)); std::string tag = JavaToStdString(jni, JavaParamRef<jstring>(j_tag));
RTC_LOG_TAG(static_cast<rtc::LoggingSeverity>(j_severity), tag.c_str()) RTC_LOG_TAG(static_cast<rtc::LoggingSeverity>(j_severity), tag) << message;
<< message;
} }
} // namespace jni } // namespace jni