Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: webrtc/base/logging.cc

Issue 1429513004: Switch usage of _DEBUG macro to NDEBUG. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: REBASE Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/logging.h ('k') | webrtc/base/network.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 char buffer[16]; 85 char buffer[16];
86 snprintf(buffer, sizeof(buffer), "0x%08x", err); 86 snprintf(buffer, sizeof(buffer), "0x%08x", err);
87 return buffer; 87 return buffer;
88 } 88 }
89 89
90 ///////////////////////////////////////////////////////////////////////////// 90 /////////////////////////////////////////////////////////////////////////////
91 // LogMessage 91 // LogMessage
92 ///////////////////////////////////////////////////////////////////////////// 92 /////////////////////////////////////////////////////////////////////////////
93 93
94 // By default, release builds don't log, debug builds at info level 94 // By default, release builds don't log, debug builds at info level
95 #if _DEBUG 95 #if !defined(NDEBUG)
96 LoggingSeverity LogMessage::min_sev_ = LS_INFO; 96 LoggingSeverity LogMessage::min_sev_ = LS_INFO;
97 LoggingSeverity LogMessage::dbg_sev_ = LS_INFO; 97 LoggingSeverity LogMessage::dbg_sev_ = LS_INFO;
98 #else // !_DEBUG 98 #else
99 LoggingSeverity LogMessage::min_sev_ = LS_NONE; 99 LoggingSeverity LogMessage::min_sev_ = LS_NONE;
100 LoggingSeverity LogMessage::dbg_sev_ = LS_NONE; 100 LoggingSeverity LogMessage::dbg_sev_ = LS_NONE;
101 #endif // !_DEBUG 101 #endif
102 bool LogMessage::log_to_stderr_ = true; 102 bool LogMessage::log_to_stderr_ = true;
103 103
104 namespace { 104 namespace {
105 // Global lock for log subsystem, only needed to serialize access to streams_. 105 // Global lock for log subsystem, only needed to serialize access to streams_.
106 CriticalSection g_log_crit; 106 CriticalSection g_log_crit;
107 } // namespace 107 } // namespace
108 108
109 // The list of logging streams currently configured. 109 // The list of logging streams currently configured.
110 // Note: we explicitly do not clean this up, because of the uncertain ordering 110 // Note: we explicitly do not clean this up, because of the uncertain ordering
111 // of destructors at program exit. Let the person who sets the stream trigger 111 // of destructors at program exit. Let the person who sets the stream trigger
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 for (auto& kv : streams_) { 333 for (auto& kv : streams_) {
334 min_sev = std::min(dbg_sev_, kv.second); 334 min_sev = std::min(dbg_sev_, kv.second);
335 } 335 }
336 min_sev_ = min_sev; 336 min_sev_ = min_sev;
337 } 337 }
338 338
339 void LogMessage::OutputToDebug(const std::string& str, 339 void LogMessage::OutputToDebug(const std::string& str,
340 LoggingSeverity severity, 340 LoggingSeverity severity,
341 const std::string& tag) { 341 const std::string& tag) {
342 bool log_to_stderr = log_to_stderr_; 342 bool log_to_stderr = log_to_stderr_;
343 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && (!defined(_DEBUG) || defined( NDEBUG)) 343 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG)
344 // On the Mac, all stderr output goes to the Console log and causes clutter. 344 // On the Mac, all stderr output goes to the Console log and causes clutter.
345 // So in opt builds, don't log to stderr unless the user specifically sets 345 // So in opt builds, don't log to stderr unless the user specifically sets
346 // a preference to do so. 346 // a preference to do so.
347 CFStringRef key = CFStringCreateWithCString(kCFAllocatorDefault, 347 CFStringRef key = CFStringCreateWithCString(kCFAllocatorDefault,
348 "logToStdErr", 348 "logToStdErr",
349 kCFStringEncodingUTF8); 349 kCFStringEncodingUTF8);
350 CFStringRef domain = CFBundleGetIdentifier(CFBundleGetMainBundle()); 350 CFStringRef domain = CFBundleGetIdentifier(CFBundleGetMainBundle());
351 if (key != NULL && domain != NULL) { 351 if (key != NULL && domain != NULL) {
352 Boolean exists_and_is_valid; 352 Boolean exists_and_is_valid;
353 Boolean should_log = 353 Boolean should_log =
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 547 }
548 548
549 if (state) { 549 if (state) {
550 state->unprintable_count_[input] = consecutive_unprintable; 550 state->unprintable_count_[input] = consecutive_unprintable;
551 } 551 }
552 } 552 }
553 553
554 ////////////////////////////////////////////////////////////////////// 554 //////////////////////////////////////////////////////////////////////
555 555
556 } // namespace rtc 556 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/logging.h ('k') | webrtc/base/network.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698