| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file overrides the logging macros in WebRTC (webrtc/base/logging.h). | 5 // This file overrides the logging macros in WebRTC (webrtc/base/logging.h). |
| 6 // Instead of using WebRTC's logging implementation, the WebRTC macros are | 6 // Instead of using WebRTC's logging implementation, the WebRTC macros are |
| 7 // mapped to DIAGNOSTIC_LOGING. In it's implementation (DiagnosticLogMessage in | 7 // mapped to DIAGNOSTIC_LOGING. In it's implementation (DiagnosticLogMessage in |
| 8 // third_party/webrtc_overrides/webrtc/base/logging.h), the corresponding | 8 // third_party/webrtc_overrides/webrtc/base/logging.h), the corresponding |
| 9 // base/logging.h macros (e.g. Chromium's VLOG) are used. | 9 // base/logging.h macros (e.g. Chromium's VLOG) are used. |
| 10 // If this file is included outside of WebRTC/libjingle it should be included | 10 // If this file is included outside of WebRTC/libjingle it should be included |
| 11 // after base/logging.h (if any) or compiler error or unexpected behavior may | 11 // after base/logging.h (if any) or compiler error or unexpected behavior may |
| 12 // occur (macros that have the same name in WebRTC as in Chromium will use | 12 // occur (macros that have the same name in WebRTC as in Chromium will use |
| 13 // the WebRTC definition if this file is included first). | 13 // the WebRTC definition if this file is included first). |
| 14 | 14 |
| 15 // Setting the LoggingSeverity (and lower) that should be written to file should | 15 // Setting the LoggingSeverity (and lower) that should be written to file should |
| 16 // be done via command line by specifying the flags: | 16 // be done via command line by specifying the flags: |
| 17 // --vmodule or --v please see base/logging.h for details on how to use them. | 17 // --vmodule or --v please see base/logging.h for details on how to use them. |
| 18 // Specifying what file to write to is done using InitLogging also in | 18 // Specifying what file to write to is done using InitLogging also in |
| 19 // base/logging.h. | 19 // base/logging.h. |
| 20 | 20 |
| 21 // The macros and classes declared in here are not described as they are | 21 // The macros and classes declared in here are not described as they are |
| 22 // NOT TO BE USED outside of WebRTC/libjingle. | 22 // NOT TO BE USED outside of WebRTC/libjingle. |
| 23 | 23 |
| 24 #ifndef THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_LOGGING_H_ | 24 #ifndef THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_LOGGING_H_ |
| 25 #define THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_LOGGING_H_ | 25 #define THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_LOGGING_H_ |
| 26 | 26 |
| 27 #include "third_party/webrtc_overrides/webrtc/base/diagnostic_logging.h" | 27 #include "third_party/webrtc_overrides/webrtc/base/diagnostic_logging.h" |
| 28 | 28 |
| 29 // If WebRTC code is built inside Chromium but run standalone, | |
| 30 // Chromium logging will be used but not initialised. This is usually | |
| 31 // OK, but in certain cases we do want that initialisation, so we | |
| 32 // expose it here. For example, you must call this if you want to | |
| 33 // decrease the log level below -1, as done by the libfuzzer fuzzers. | |
| 34 namespace rtc { | |
| 35 void InitChromiumLoggingAndCommandLine(); | |
| 36 } | |
| 37 | |
| 38 ////////////////////////////////////////////////////////////////////// | 29 ////////////////////////////////////////////////////////////////////// |
| 39 // WebRTC macros which in DiagnosticLogMessage are mapped over to | 30 // WebRTC macros which in DiagnosticLogMessage are mapped over to |
| 40 // their VLOG equivalent in base/logging.h. | 31 // their VLOG equivalent in base/logging.h. |
| 41 ////////////////////////////////////////////////////////////////////// | 32 ////////////////////////////////////////////////////////////////////// |
| 42 | 33 |
| 43 #if defined(LOGGING_INSIDE_WEBRTC) | 34 #if defined(LOGGING_INSIDE_WEBRTC) |
| 44 | 35 |
| 45 #include <errno.h> | 36 #include <errno.h> |
| 46 | 37 |
| 47 namespace rtc { | 38 namespace rtc { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #define LOG_ERR(sev) LOG_ERRNO(sev) | 86 #define LOG_ERR(sev) LOG_ERRNO(sev) |
| 96 #define LAST_SYSTEM_ERROR (errno) | 87 #define LAST_SYSTEM_ERROR (errno) |
| 97 #endif // OS_WIN | 88 #endif // OS_WIN |
| 98 | 89 |
| 99 #undef PLOG | 90 #undef PLOG |
| 100 #define PLOG(sev, err) LOG_ERR_EX(sev, err) | 91 #define PLOG(sev, err) LOG_ERR_EX(sev, err) |
| 101 | 92 |
| 102 #endif // LOGGING_INSIDE_WEBRTC | 93 #endif // LOGGING_INSIDE_WEBRTC |
| 103 | 94 |
| 104 #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_LOGGING_H_ | 95 #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_LOGGING_H_ |
| OLD | NEW |