| 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 #ifndef THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ | 5 #ifndef THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ |
| 6 #define THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ | 6 #define THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ |
| 7 | 7 |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Note that the non-standard LoggingSeverity aliases exist because they are | 42 // Note that the non-standard LoggingSeverity aliases exist because they are |
| 43 // still in broad use. The meanings of the levels are: | 43 // still in broad use. The meanings of the levels are: |
| 44 // LS_SENSITIVE: Information which should only be logged with the consent | 44 // LS_SENSITIVE: Information which should only be logged with the consent |
| 45 // of the user, due to privacy concerns. | 45 // of the user, due to privacy concerns. |
| 46 // LS_VERBOSE: This level is for data which we do not want to appear in the | 46 // LS_VERBOSE: This level is for data which we do not want to appear in the |
| 47 // normal debug log, but should appear in diagnostic logs. | 47 // normal debug log, but should appear in diagnostic logs. |
| 48 // LS_INFO: Chatty level used in debugging for all sorts of things, the default | 48 // LS_INFO: Chatty level used in debugging for all sorts of things, the default |
| 49 // in debug builds. | 49 // in debug builds. |
| 50 // LS_WARNING: Something that may warrant investigation. | 50 // LS_WARNING: Something that may warrant investigation. |
| 51 // LS_ERROR: Something that should not have occurred. | 51 // LS_ERROR: Something that should not have occurred. |
| 52 // LS_NONE: A level < LS_ERROR, used to disable logging. | |
| 53 // Note that LoggingSeverity is mapped over to chromiums verbosity levels where | 52 // Note that LoggingSeverity is mapped over to chromiums verbosity levels where |
| 54 // anything lower than or equal to the current verbosity level is written to | 53 // anything lower than or equal to the current verbosity level is written to |
| 55 // file which is the opposite of logging severity in libjingle where higher | 54 // file which is the opposite of logging severity in libjingle where higher |
| 56 // severity numbers than or equal to the current severity level are written to | 55 // severity numbers than or equal to the current severity level are written to |
| 57 // file. Also, note that the values are explicitly defined here for convenience | 56 // file. Also, note that the values are explicitly defined here for convenience |
| 58 // since the command line flag must be set using numerical values. | 57 // since the command line flag must be set using numerical values. |
| 59 // | |
| 60 // LS_NONE is present so we can LogToDebug(LS_NONE) i.e. for ordinal | |
| 61 // comparisons with other log levels. | |
| 62 // | |
| 63 // TODO(tommi): To keep things simple, we should just use the same values for | 58 // TODO(tommi): To keep things simple, we should just use the same values for |
| 64 // these constants as Chrome does. | 59 // these constants as Chrome does. |
| 65 enum LoggingSeverity { LS_NONE = 0, | 60 enum LoggingSeverity { LS_ERROR = 1, |
| 66 LS_ERROR = 1, | |
| 67 LS_WARNING = 2, | 61 LS_WARNING = 2, |
| 68 LS_INFO = 3, | 62 LS_INFO = 3, |
| 69 LS_VERBOSE = 4, | 63 LS_VERBOSE = 4, |
| 70 LS_SENSITIVE = 5, | 64 LS_SENSITIVE = 5, |
| 71 INFO = LS_INFO, | 65 INFO = LS_INFO, |
| 72 WARNING = LS_WARNING, | 66 WARNING = LS_WARNING, |
| 73 LERROR = LS_ERROR }; | 67 LERROR = LS_ERROR }; |
| 74 | 68 |
| 75 // LogErrorContext assists in interpreting the meaning of an error value. | 69 // LogErrorContext assists in interpreting the meaning of an error value. |
| 76 enum LogErrorContext { | 70 enum LogErrorContext { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 class LogMultilineState { | 123 class LogMultilineState { |
| 130 public: | 124 public: |
| 131 size_t unprintable_count_[2]; | 125 size_t unprintable_count_[2]; |
| 132 LogMultilineState() { | 126 LogMultilineState() { |
| 133 unprintable_count_[0] = unprintable_count_[1] = 0; | 127 unprintable_count_[0] = unprintable_count_[1] = 0; |
| 134 } | 128 } |
| 135 }; | 129 }; |
| 136 | 130 |
| 137 class LogMessage { | 131 class LogMessage { |
| 138 public: | 132 public: |
| 139 static void LogToDebug(LoggingSeverity min_sev); | 133 static void LogToDebug(int min_sev); |
| 140 }; | 134 }; |
| 141 | 135 |
| 142 // When possible, pass optional state variable to track various data across | 136 // When possible, pass optional state variable to track various data across |
| 143 // multiple calls to LogMultiline. Otherwise, pass NULL. | 137 // multiple calls to LogMultiline. Otherwise, pass NULL. |
| 144 void LogMultiline(LoggingSeverity level, const char* label, bool input, | 138 void LogMultiline(LoggingSeverity level, const char* label, bool input, |
| 145 const void* data, size_t len, bool hex_mode, | 139 const void* data, size_t len, bool hex_mode, |
| 146 LogMultilineState* state); | 140 LogMultilineState* state); |
| 147 | 141 |
| 148 // TODO(grunell): Change name to InitDiagnosticLoggingDelegate or | 142 // TODO(grunell): Change name to InitDiagnosticLoggingDelegate or |
| 149 // InitDiagnosticLogging. Change also in init_webrtc.h/cc. | 143 // InitDiagnosticLogging. Change also in init_webrtc.h/cc. |
| 150 // TODO(grunell): typedef the delegate function. | 144 // TODO(grunell): typedef the delegate function. |
| 151 void InitDiagnosticLoggingDelegateFunction( | 145 void InitDiagnosticLoggingDelegateFunction( |
| 152 void (*delegate)(const std::string&)); | 146 void (*delegate)(const std::string&)); |
| 153 | 147 |
| 154 void SetExtraLoggingInit( | 148 void SetExtraLoggingInit( |
| 155 void (*function)(void (*delegate)(const std::string&))); | 149 void (*function)(void (*delegate)(const std::string&))); |
| 156 | 150 |
| 157 } // namespace rtc | 151 } // namespace rtc |
| 158 | 152 |
| 159 #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ | 153 #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ |
| OLD | NEW |