| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #include "rtc_base/logging.h" |
| 12 |
| 13 | #include <string.h> |
| 14 |
| 15 | #if RTC_LOG_ENABLED() |
| 16 |
| 17 | #if defined(WEBRTC_WIN) |
| 18 | #include <windows.h> |
| 19 | #if _MSC_VER < 1900 |
| 20 | #define snprintf _snprintf |
| 21 | #endif |
| 22 | #undef ERROR // wingdi.h |
| 23 | #endif |
| 24 |
| 25 | #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) |
| 26 | #include <CoreServices/CoreServices.h> |
| 27 | #elif defined(WEBRTC_ANDROID) |
| 28 | #include <android/log.h> |
| 29 |
| 30 | // Android has a 1024 limit on log inputs. We use 60 chars as an |
| 31 | // approx for the header/tag portion. |
| 32 | // See android/system/core/liblog/logd_write.c |
| 33 | static const int kMaxLogLineSize = 1024 - 60; |
| 34 | #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID |
| 35 |
| 36 | #include <inttypes.h> |
| 37 | #include <stdio.h> |
| 38 | #include <time.h> |
| 39 |
| 40 | #include <algorithm> |
| 41 | #include <cstdarg> |
| 42 | #include <vector> |
| 43 |
| 44 | #include "absl/base/attributes.h" |
| 45 | #include "rtc_base/checks.h" |
| 46 | #include "rtc_base/platform_thread_types.h" |
| 47 | #include "rtc_base/string_encode.h" |
| 48 | #include "rtc_base/string_utils.h" |
| 49 | #include "rtc_base/strings/string_builder.h" |
| 50 | #include "rtc_base/synchronization/mutex.h" |
| 51 | #include "rtc_base/thread_annotations.h" |
| 52 | #include "rtc_base/time_utils.h" |
| 53 |
| 54 | namespace rtc { |
| 55 | namespace { |
| 56 | // By default, release builds don't log, debug builds at info level |
| 57 | #if !defined(NDEBUG) |
| 58 | static LoggingSeverity g_min_sev = LS_INFO; |
| 59 | static LoggingSeverity g_dbg_sev = LS_INFO; |
| 60 | #else |
| 61 | static LoggingSeverity g_min_sev = LS_NONE; |
| 62 | static LoggingSeverity g_dbg_sev = LS_NONE; |
| 63 | #endif |
| 64 |
| 65 | // Return the filename portion of the string (that following the last slash). |
| 66 | const char* FilenameFromPath(const char* file) { |
| 67 | const char* end1 = ::strrchr(file, '/'); |
| 68 | const char* end2 = ::strrchr(file, '\\'); |
| 69 | if (!end1 && !end2) |
| 70 | return file; |
| 71 | else |
| 72 | return (end1 > end2) ? end1 + 1 : end2 + 1; |
| 73 | } |
| 74 |
| 75 | // Global lock for log subsystem, only needed to serialize access to streams_. |
| 76 | webrtc::Mutex& GetLoggingLock() { |
| 77 | static webrtc::Mutex& mutex = *new webrtc::Mutex(); |
| 78 | return mutex; |
| 79 | } |
| 80 |
| 81 | } // namespace |
| 82 |
| 83 | ///////////////////////////////////////////////////////////////////////////// |
| 84 | // LogMessage |
| 85 | ///////////////////////////////////////////////////////////////////////////// |
| 86 |
| 87 | bool LogMessage::log_to_stderr_ = true; |
| 88 |
| 89 | // The list of logging streams currently configured. |
| 90 | // Note: we explicitly do not clean this up, because of the uncertain ordering |
| 91 | // of destructors at program exit. Let the person who sets the stream trigger |
| 92 | // cleanup by setting to null, or let it leak (safe at program exit). |
| 93 | ABSL_CONST_INIT LogSink* LogMessage::streams_ RTC_GUARDED_BY(GetLoggingLock()) = |
| 94 | nullptr; |
| 95 | ABSL_CONST_INIT std::atomic<bool> LogMessage::streams_empty_ = {true}; |
| 96 |
| 97 | // Boolean options default to false (0) |
| 98 | bool LogMessage::thread_, LogMessage::timestamp_; |
| 99 |
| 100 | LogMessage::LogMessage(const char* file, int line, LoggingSeverity sev) |
| 101 | : LogMessage(file, line, sev, ERRCTX_NONE, 0) {} |
| 102 |
| 103 | LogMessage::LogMessage(const char* file, |
| 104 | int line, |
| 105 | LoggingSeverity sev, |
| 106 | LogErrorContext err_ctx, |
| 107 | int err) |
| 108 | : severity_(sev) { |
| 109 | if (timestamp_) { |
| 110 | // Use SystemTimeMillis so that even if tests use fake clocks, the timestamp |
| 111 | // in log messages represents the real system time. |
| 112 | int64_t time = TimeDiff(SystemTimeMillis(), LogStartTime()); |
| 113 | // Also ensure WallClockStartTime is initialized, so that it matches |
| 114 | // LogStartTime. |
| 115 | WallClockStartTime(); |
| 116 | // TODO(kwiberg): Switch to absl::StrFormat, if binary size is ok. |
| 117 | char timestamp[50]; // Maximum string length of an int64_t is 20. |
| 118 | int len = |
| 119 | snprintf(timestamp, sizeof(timestamp), "[%03" PRId64 ":%03" PRId64 "]", |
| 120 | time / 1000, time % 1000); |
| 121 | RTC_DCHECK_LT(len, sizeof(timestamp)); |
| 122 | print_stream_ << timestamp; |
| 123 | } |
| 124 |
| 125 | if (thread_) { |
| 126 | PlatformThreadId id = CurrentThreadId(); |
| 127 | print_stream_ << "[" << id << "] "; |
| 128 | } |
| 129 |
| 130 | if (file != nullptr) { |
| 131 | #if defined(WEBRTC_ANDROID) |
| 132 | tag_ = FilenameFromPath(file); |
| 133 | print_stream_ << "(line " << line << "): "; |
| 134 | #else |
| 135 | print_stream_ << "(" << FilenameFromPath(file) << ":" << line << "): "; |
| 136 | #endif |
| 137 | } |
| 138 |
| 139 | if (err_ctx != ERRCTX_NONE) { |
| 140 | char tmp_buf[1024]; |
| 141 | SimpleStringBuilder tmp(tmp_buf); |
| 142 | tmp.AppendFormat("[0x%08X]", err); |
| 143 | switch (err_ctx) { |
| 144 | case ERRCTX_ERRNO: |
| 145 | tmp << " " << strerror(err); |
| 146 | break; |
| 147 | #ifdef WEBRTC_WIN |
| 148 | case ERRCTX_HRESULT: { |
| 149 | char msgbuf[256]; |
| 150 | DWORD flags = |
| 151 | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; |
| 152 | if (DWORD len = FormatMessageA( |
| 153 | flags, nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 154 | msgbuf, sizeof(msgbuf) / sizeof(msgbuf[0]), nullptr)) { |
| 155 | while ((len > 0) && |
| 156 | isspace(static_cast<unsigned char>(msgbuf[len - 1]))) { |
| 157 | msgbuf[--len] = 0; |
| 158 | } |
| 159 | tmp << " " << msgbuf; |
| 160 | } |
| 161 | break; |
| 162 | } |
| 163 | #endif // WEBRTC_WIN |
| 164 | default: |
| 165 | break; |
| 166 | } |
| 167 | extra_ = tmp.str(); |
| 168 | } |
| 169 | } |
| 170 |
| 171 | #if defined(WEBRTC_ANDROID) |
| 172 | LogMessage::LogMessage(const char* file, |
| 173 | int line, |
| 174 | LoggingSeverity sev, |
| 175 | const char* tag) |
| 176 | : LogMessage(file, line, sev, ERRCTX_NONE, 0 /* err */) { |
| 177 | tag_ = tag; |
| 178 | print_stream_ << tag << ": "; |
| 179 | } |
| 180 | #endif |
| 181 |
| 182 | // DEPRECATED. Currently only used by downstream projects that use |
| 183 | // implementation details of logging.h. Work is ongoing to remove those |
| 184 | // dependencies. |
| 185 | LogMessage::LogMessage(const char* file, |
| 186 | int line, |
| 187 | LoggingSeverity sev, |
| 188 | const std::string& tag) |
| 189 | : LogMessage(file, line, sev) { |
| 190 | print_stream_ << tag << ": "; |
| 191 | } |
| 192 |
| 193 | LogMessage::~LogMessage() { |
| 194 | FinishPrintStream(); |
| 195 |
| 196 | const std::string str = print_stream_.Release(); |
| 197 |
| 198 | if (severity_ >= g_dbg_sev) { |
| 199 | #if defined(WEBRTC_ANDROID) |
| 200 | OutputToDebug(str, severity_, tag_); |
| 201 | #else |
| 202 | OutputToDebug(str, severity_); |
| 203 | #endif |
| 204 | } |
| 205 |
| 206 | webrtc::MutexLock lock(&GetLoggingLock()); |
| 207 | for (LogSink* entry = streams_; entry != nullptr; entry = entry->next_) { |
| 208 | if (severity_ >= entry->min_severity_) { |
| 209 | #if defined(WEBRTC_ANDROID) |
| 210 | entry->OnLogMessage(str, severity_, tag_); |
| 211 | #else |
| 212 | entry->OnLogMessage(str, severity_); |
| 213 | #endif |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 |
| 218 | void LogMessage::AddTag(const char* tag) { |
| 219 | #ifdef WEBRTC_ANDROID |
| 220 | tag_ = tag; |
| 221 | #endif |
| 222 | } |
| 223 |
| 224 | rtc::StringBuilder& LogMessage::stream() { |
| 225 | return print_stream_; |
| 226 | } |
| 227 |
| 228 | int LogMessage::GetMinLogSeverity() { |
| 229 | return g_min_sev; |
| 230 | } |
| 231 |
| 232 | LoggingSeverity LogMessage::GetLogToDebug() { |
| 233 | return g_dbg_sev; |
| 234 | } |
| 235 | int64_t LogMessage::LogStartTime() { |
| 236 | static const int64_t g_start = SystemTimeMillis(); |
| 237 | return g_start; |
| 238 | } |
| 239 |
| 240 | uint32_t LogMessage::WallClockStartTime() { |
| 241 | static const uint32_t g_start_wallclock = time(nullptr); |
| 242 | return g_start_wallclock; |
| 243 | } |
| 244 |
| 245 | void LogMessage::LogThreads(bool on) { |
| 246 | thread_ = on; |
| 247 | } |
| 248 |
| 249 | void LogMessage::LogTimestamps(bool on) { |
| 250 | timestamp_ = on; |
| 251 | } |
| 252 |
| 253 | void LogMessage::LogToDebug(LoggingSeverity min_sev) { |
| 254 | g_dbg_sev = min_sev; |
| 255 | webrtc::MutexLock lock(&GetLoggingLock()); |
| 256 | UpdateMinLogSeverity(); |
| 257 | } |
| 258 |
| 259 | void LogMessage::SetLogToStderr(bool log_to_stderr) { |
| 260 | log_to_stderr_ = log_to_stderr; |
| 261 | } |
| 262 |
| 263 | int LogMessage::GetLogToStream(LogSink* stream) { |
| 264 | webrtc::MutexLock lock(&GetLoggingLock()); |
| 265 | LoggingSeverity sev = LS_NONE; |
| 266 | for (LogSink* entry = streams_; entry != nullptr; entry = entry->next_) { |
| 267 | if (stream == nullptr || stream == entry) { |
| 268 | sev = std::min(sev, entry->min_severity_); |
| 269 | } |
| 270 | } |
| 271 | return sev; |
| 272 | } |
| 273 |
| 274 | void LogMessage::AddLogToStream(LogSink* stream, LoggingSeverity min_sev) { |
| 275 | webrtc::MutexLock lock(&GetLoggingLock()); |
| 276 | stream->min_severity_ = min_sev; |
| 277 | stream->next_ = streams_; |
| 278 | streams_ = stream; |
| 279 | streams_empty_.store(false, std::memory_order_relaxed); |
| 280 | UpdateMinLogSeverity(); |
| 281 | } |
| 282 |
| 283 | void LogMessage::RemoveLogToStream(LogSink* stream) { |
| 284 | webrtc::MutexLock lock(&GetLoggingLock()); |
| 285 | for (LogSink** entry = &streams_; *entry != nullptr; |
| 286 | entry = &(*entry)->next_) { |
| 287 | if (*entry == stream) { |
| 288 | *entry = (*entry)->next_; |
| 289 | break; |
| 290 | } |
| 291 | } |
| 292 | streams_empty_.store(streams_ == nullptr, std::memory_order_relaxed); |
| 293 | UpdateMinLogSeverity(); |
| 294 | } |
| 295 |
| 296 | void LogMessage::ConfigureLogging(const char* params) { |
| 297 | LoggingSeverity current_level = LS_VERBOSE; |
| 298 | LoggingSeverity debug_level = GetLogToDebug(); |
| 299 |
| 300 | std::vector<std::string> tokens; |
| 301 | tokenize(params, ' ', &tokens); |
| 302 |
| 303 | for (const std::string& token : tokens) { |
| 304 | if (token.empty()) |
| 305 | continue; |
| 306 |
| 307 | // Logging features |
| 308 | if (token == "tstamp") { |
| 309 | LogTimestamps(); |
| 310 | } else if (token == "thread") { |
| 311 | LogThreads(); |
| 312 |
| 313 | // Logging levels |
| 314 | } else if (token == "verbose") { |
| 315 | current_level = LS_VERBOSE; |
| 316 | } else if (token == "info") { |
| 317 | current_level = LS_INFO; |
| 318 | } else if (token == "warning") { |
| 319 | current_level = LS_WARNING; |
| 320 | } else if (token == "error") { |
| 321 | current_level = LS_ERROR; |
| 322 | } else if (token == "none") { |
| 323 | current_level = LS_NONE; |
| 324 |
| 325 | // Logging targets |
| 326 | } else if (token == "debug") { |
| 327 | debug_level = current_level; |
| 328 | } |
| 329 | } |
| 330 |
| 331 | #if defined(WEBRTC_WIN) && !defined(WINUWP) |
| 332 | if ((LS_NONE != debug_level) && !::IsDebuggerPresent()) { |
| 333 | // First, attempt to attach to our parent's console... so if you invoke |
| 334 | // from the command line, we'll see the output there. Otherwise, create |
| 335 | // our own console window. |
| 336 | // Note: These methods fail if a console already exists, which is fine. |
| 337 | if (!AttachConsole(ATTACH_PARENT_PROCESS)) |
| 338 | ::AllocConsole(); |
| 339 | } |
| 340 | #endif // defined(WEBRTC_WIN) && !defined(WINUWP) |
| 341 |
| 342 | LogToDebug(debug_level); |
| 343 | } |
| 344 |
| 345 | void LogMessage::UpdateMinLogSeverity() |
| 346 | RTC_EXCLUSIVE_LOCKS_REQUIRED(GetLoggingLock()) { |
| 347 | LoggingSeverity min_sev = g_dbg_sev; |
| 348 | for (LogSink* entry = streams_; entry != nullptr; entry = entry->next_) { |
| 349 | min_sev = std::min(min_sev, entry->min_severity_); |
| 350 | } |
| 351 | g_min_sev = min_sev; |
| 352 | } |
| 353 |
| 354 | #if defined(WEBRTC_ANDROID) |
| 355 | void LogMessage::OutputToDebug(const std::string& str, |
| 356 | LoggingSeverity severity, |
| 357 | const char* tag) { |
| 358 | #else |
| 359 | void LogMessage::OutputToDebug(const std::string& str, |
| 360 | LoggingSeverity severity) { |
| 361 | #endif |
| 362 | bool log_to_stderr = log_to_stderr_; |
| 363 | #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG) |
| 364 | // On the Mac, all stderr output goes to the Console log and causes clutter. |
| 365 | // So in opt builds, don't log to stderr unless the user specifically sets |
| 366 | // a preference to do so. |
| 367 | CFStringRef key = CFStringCreateWithCString( |
| 368 | kCFAllocatorDefault, "logToStdErr", kCFStringEncodingUTF8); |
| 369 | CFStringRef domain = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
| 370 | if (key != nullptr && domain != nullptr) { |
| 371 | Boolean exists_and_is_valid; |
| 372 | Boolean should_log = |
| 373 | CFPreferencesGetAppBooleanValue(key, domain, &exists_and_is_valid); |
| 374 | // If the key doesn't exist or is invalid or is false, we will not log to |
| 375 | // stderr. |
| 376 | log_to_stderr = exists_and_is_valid && should_log; |
| 377 | } |
| 378 | if (key != nullptr) { |
| 379 | CFRelease(key); |
| 380 | } |
| 381 | #endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG) |
| 382 |
| 383 | #if defined(WEBRTC_WIN) |
| 384 | // Always log to the debugger. |
| 385 | // Perhaps stderr should be controlled by a preference, as on Mac? |
| 386 | OutputDebugStringA(str.c_str()); |
| 387 | if (log_to_stderr) { |
| 388 | // This handles dynamically allocated consoles, too. |
| 389 | if (HANDLE error_handle = ::GetStdHandle(STD_ERROR_HANDLE)) { |
| 390 | log_to_stderr = false; |
| 391 | DWORD written = 0; |
| 392 | ::WriteFile(error_handle, str.data(), static_cast<DWORD>(str.size()), |
| 393 | &written, 0); |
| 394 | } |
| 395 | } |
| 396 | #endif // WEBRTC_WIN |
| 397 |
| 398 | #if defined(WEBRTC_ANDROID) |
| 399 | // Android's logging facility uses severity to log messages but we |
| 400 | // need to map libjingle's severity levels to Android ones first. |
| 401 | // Also write to stderr which maybe available to executable started |
| 402 | // from the shell. |
| 403 | int prio; |
| 404 | switch (severity) { |
| 405 | case LS_VERBOSE: |
| 406 | prio = ANDROID_LOG_VERBOSE; |
| 407 | break; |
| 408 | case LS_INFO: |
| 409 | prio = ANDROID_LOG_INFO; |
| 410 | break; |
| 411 | case LS_WARNING: |
| 412 | prio = ANDROID_LOG_WARN; |
| 413 | break; |
| 414 | case LS_ERROR: |
| 415 | prio = ANDROID_LOG_ERROR; |
| 416 | break; |
| 417 | default: |
| 418 | prio = ANDROID_LOG_UNKNOWN; |
| 419 | } |
| 420 |
| 421 | int size = str.size(); |
| 422 | int line = 0; |
| 423 | int idx = 0; |
| 424 | const int max_lines = size / kMaxLogLineSize + 1; |
| 425 | if (max_lines == 1) { |
| 426 | __android_log_print(prio, tag, "%.*s", size, str.c_str()); |
| 427 | } else { |
| 428 | while (size > 0) { |
| 429 | const int len = std::min(size, kMaxLogLineSize); |
| 430 | // Use the size of the string in the format (str may have \0 in the |
| 431 | // middle). |
| 432 | __android_log_print(prio, tag, "[%d/%d] %.*s", line + 1, max_lines, len, |
| 433 | str.c_str() + idx); |
| 434 | idx += len; |
| 435 | size -= len; |
| 436 | ++line; |
| 437 | } |
| 438 | } |
| 439 | #endif // WEBRTC_ANDROID |
| 440 | if (log_to_stderr) { |
| 441 | fprintf(stderr, "%s", str.c_str()); |
| 442 | fflush(stderr); |
| 443 | } |
| 444 | } |
| 445 |
| 446 | // static |
| 447 | bool LogMessage::IsNoop(LoggingSeverity severity) { |
| 448 | if (severity >= g_dbg_sev || severity >= g_min_sev) |
| 449 | return false; |
| 450 | return streams_empty_.load(std::memory_order_relaxed); |
| 451 | } |
| 452 |
| 453 | void LogMessage::FinishPrintStream() { |
| 454 | if (!extra_.empty()) |
| 455 | print_stream_ << " : " << extra_; |
| 456 | print_stream_ << "\n"; |
| 457 | } |
| 458 |
| 459 | namespace webrtc_logging_impl { |
| 460 |
| 461 | void Log(const LogArgType* fmt, ...) { |
| 462 | va_list args; |
| 463 | va_start(args, fmt); |
| 464 |
| 465 | LogMetadataErr meta; |
| 466 | const char* tag = nullptr; |
| 467 | switch (*fmt) { |
| 468 | case LogArgType::kLogMetadata: { |
| 469 | meta = {va_arg(args, LogMetadata), ERRCTX_NONE, 0}; |
| 470 | break; |
| 471 | } |
| 472 | case LogArgType::kLogMetadataErr: { |
| 473 | meta = va_arg(args, LogMetadataErr); |
| 474 | break; |
| 475 | } |
| 476 | #ifdef WEBRTC_ANDROID |
| 477 | case LogArgType::kLogMetadataTag: { |
| 478 | const LogMetadataTag tag_meta = va_arg(args, LogMetadataTag); |
| 479 | meta = {{nullptr, 0, tag_meta.severity}, ERRCTX_NONE, 0}; |
| 480 | tag = tag_meta.tag; |
| 481 | break; |
| 482 | } |
| 483 | #endif |
| 484 | default: { |
| 485 | RTC_DCHECK_NOTREACHED(); |
| 486 | va_end(args); |
| 487 | return; |
| 488 | } |
| 489 | } |
| 490 |
| 491 | LogMessage log_message(meta.meta.File(), meta.meta.Line(), |
| 492 | meta.meta.Severity(), meta.err_ctx, meta.err); |
| 493 | if (tag) { |
| 494 | log_message.AddTag(tag); |
| 495 | } |
| 496 |
| 497 | for (++fmt; *fmt != LogArgType::kEnd; ++fmt) { |
| 498 | switch (*fmt) { |
| 499 | case LogArgType::kInt: |
| 500 | log_message.stream() << va_arg(args, int); |
| 501 | break; |
| 502 | case LogArgType::kLong: |
| 503 | log_message.stream() << va_arg(args, long); |
| 504 | break; |
| 505 | case LogArgType::kLongLong: |
| 506 | log_message.stream() << va_arg(args, long long); |
| 507 | break; |
| 508 | case LogArgType::kUInt: |
| 509 | log_message.stream() << va_arg(args, unsigned); |
| 510 | break; |
| 511 | case LogArgType::kULong: |
| 512 | log_message.stream() << va_arg(args, unsigned long); |
| 513 | break; |
| 514 | case LogArgType::kULongLong: |
| 515 | log_message.stream() << va_arg(args, unsigned long long); |
| 516 | break; |
| 517 | case LogArgType::kDouble: |
| 518 | log_message.stream() << va_arg(args, double); |
| 519 | break; |
| 520 | case LogArgType::kLongDouble: |
| 521 | log_message.stream() << va_arg(args, long double); |
| 522 | break; |
| 523 | case LogArgType::kCharP: { |
| 524 | const char* s = va_arg(args, const char*); |
| 525 | log_message.stream() << (s ? s : "(null)"); |
| 526 | break; |
| 527 | } |
| 528 | case LogArgType::kStdString: |
| 529 | log_message.stream() << *va_arg(args, const std::string*); |
| 530 | break; |
| 531 | case LogArgType::kStringView: |
| 532 | log_message.stream() << *va_arg(args, const absl::string_view*); |
| 533 | break; |
| 534 | case LogArgType::kVoidP: |
| 535 | log_message.stream() << rtc::ToHex( |
| 536 | reinterpret_cast<uintptr_t>(va_arg(args, const void*))); |
| 537 | break; |
| 538 | default: |
| 539 | RTC_DCHECK_NOTREACHED(); |
| 540 | va_end(args); |
| 541 | return; |
| 542 | } |
| 543 | } |
| 544 |
| 545 | va_end(args); |
| 546 | } |
| 547 |
| 548 | } // namespace webrtc_logging_impl |
| 549 | } // namespace rtc |
| 550 | #endif |
| 551 |
| 552 | namespace rtc { |
| 553 | // Inefficient default implementation, override is recommended. |
| 554 | void LogSink::OnLogMessage(const std::string& msg, |
| 555 | LoggingSeverity severity, |
| 556 | const char* tag) { |
| 557 | OnLogMessage(tag + (": " + msg), severity); |
| 558 | } |
| 559 |
| 560 | void LogSink::OnLogMessage(const std::string& msg, |
| 561 | LoggingSeverity /* severity */) { |
| 562 | OnLogMessage(msg); |
| 563 | } |
| 564 | } // namespace rtc |
| 565 |