OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "third_party/libjingle/overrides/talk/base/logging.h" | 5 #include "third_party/libjingle/overrides/talk/base/logging.h" |
6 | 6 |
7 #if defined(OS_MACOSX) && !defined(OS_IOS) | 7 #if defined(OS_MACOSX) && !defined(OS_IOS) |
8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
9 #endif // OS_MACOSX | 9 #endif // OS_MACOSX |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... | |
24 // ~DiagnosticLogMessage. Note that the second parameter to the LAZY_STREAM | 24 // ~DiagnosticLogMessage. Note that the second parameter to the LAZY_STREAM |
25 // macro is true since the filter check has already been done for | 25 // macro is true since the filter check has already been done for |
26 // DIAGNOSTIC_LOG. | 26 // DIAGNOSTIC_LOG. |
27 #define LOG_LAZY_STREAM_DIRECT(file_name, line_number, sev) \ | 27 #define LOG_LAZY_STREAM_DIRECT(file_name, line_number, sev) \ |
28 LAZY_STREAM(logging::LogMessage(file_name, line_number, \ | 28 LAZY_STREAM(logging::LogMessage(file_name, line_number, \ |
29 -sev).stream(), true) | 29 -sev).stream(), true) |
30 | 30 |
31 namespace talk_base { | 31 namespace talk_base { |
32 | 32 |
33 void (*g_logging_delegate_function)(const std::string&) = NULL; | 33 void (*g_logging_delegate_function)(const std::string&) = NULL; |
34 void (*g_extra_logging_init_function)( | |
35 void (*logging_delegate_function)(const std::string&)) = NULL; | |
34 #ifndef NDEBUG | 36 #ifndef NDEBUG |
35 COMPILE_ASSERT(sizeof(base::subtle::Atomic32) == sizeof(base::PlatformThreadId), | 37 COMPILE_ASSERT(sizeof(base::subtle::Atomic32) == sizeof(base::PlatformThreadId), |
36 atomic32_not_same_size_as_platformthreadid); | 38 atomic32_not_same_size_as_platformthreadid); |
37 base::subtle::Atomic32 g_init_logging_delegate_thread_id = 0; | 39 base::subtle::Atomic32 g_init_logging_delegate_thread_id = 0; |
38 #endif | 40 #endif |
39 | 41 |
40 ///////////////////////////////////////////////////////////////////////////// | 42 ///////////////////////////////////////////////////////////////////////////// |
41 // Constant Labels | 43 // Constant Labels |
42 ///////////////////////////////////////////////////////////////////////////// | 44 ///////////////////////////////////////////////////////////////////////////// |
43 | 45 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 // This function may be called with the same argument several times if the | 303 // This function may be called with the same argument several times if the |
302 // page is reloaded or there are several PeerConnections on one page with | 304 // page is reloaded or there are several PeerConnections on one page with |
303 // logging enabled. This is OK, we simply don't have to do anything. | 305 // logging enabled. This is OK, we simply don't have to do anything. |
304 if (delegate == g_logging_delegate_function) | 306 if (delegate == g_logging_delegate_function) |
305 return; | 307 return; |
306 CHECK(!g_logging_delegate_function); | 308 CHECK(!g_logging_delegate_function); |
307 #ifdef NDEBUG | 309 #ifdef NDEBUG |
308 IPAddress::set_strip_sensitive(true); | 310 IPAddress::set_strip_sensitive(true); |
309 #endif | 311 #endif |
310 g_logging_delegate_function = delegate; | 312 g_logging_delegate_function = delegate; |
313 | |
314 if (g_extra_logging_init_function) | |
315 g_extra_logging_init_function(delegate); | |
316 } | |
317 | |
318 void SetExtraLoggingInit( | |
319 void (*function)(void (*delegate)(const std::string&))) { | |
tommi (sloooow) - chröme
2013/11/14 08:12:18
nit: it would be more readable to have a typedef f
Henrik Grunell
2013/11/14 09:04:08
Agree, added todo in the header.
| |
320 CHECK(function); | |
321 CHECK(!g_extra_logging_init_function); | |
322 g_extra_logging_init_function = function; | |
311 } | 323 } |
312 | 324 |
313 } // namespace talk_base | 325 } // namespace talk_base |
OLD | NEW |