Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // Note that LoggingSeverity is mapped over to chromiums verbosity levels where | 52 // Note that LoggingSeverity is mapped over to chromiums verbosity levels where |
| 53 // 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 |
| 54 // 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 |
| 55 // 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 |
| 56 // 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 |
| 57 // since the command line flag must be set using numerical values. | 57 // since the command line flag must be set using numerical values. |
| 58 // 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 |
| 59 // these constants as Chrome does. | 59 // these constants as Chrome does. |
| 60 enum LoggingSeverity { LS_ERROR = 1, | 60 enum LoggingSeverity { LS_NONE = 0, |
|
Henrik Grunell
2016/05/18 08:43:26
Describe this in the comment.
katrielc
2016/05/18 09:06:42
Acknowledged.
| |
| 61 LS_ERROR = 1, | |
| 61 LS_WARNING = 2, | 62 LS_WARNING = 2, |
| 62 LS_INFO = 3, | 63 LS_INFO = 3, |
| 63 LS_VERBOSE = 4, | 64 LS_VERBOSE = 4, |
| 64 LS_SENSITIVE = 5, | 65 LS_SENSITIVE = 5, |
| 65 INFO = LS_INFO, | 66 INFO = LS_INFO, |
| 66 WARNING = LS_WARNING, | 67 WARNING = LS_WARNING, |
| 67 LERROR = LS_ERROR }; | 68 LERROR = LS_ERROR }; |
| 68 | 69 |
| 69 // LogErrorContext assists in interpreting the meaning of an error value. | 70 // LogErrorContext assists in interpreting the meaning of an error value. |
| 70 enum LogErrorContext { | 71 enum LogErrorContext { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 class LogMultilineState { | 124 class LogMultilineState { |
| 124 public: | 125 public: |
| 125 size_t unprintable_count_[2]; | 126 size_t unprintable_count_[2]; |
| 126 LogMultilineState() { | 127 LogMultilineState() { |
| 127 unprintable_count_[0] = unprintable_count_[1] = 0; | 128 unprintable_count_[0] = unprintable_count_[1] = 0; |
| 128 } | 129 } |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 class LogMessage { | 132 class LogMessage { |
| 132 public: | 133 public: |
| 133 static void LogToDebug(int min_sev); | 134 static void LogToDebug(LoggingSeverity min_sev); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 // When possible, pass optional state variable to track various data across | 137 // When possible, pass optional state variable to track various data across |
| 137 // multiple calls to LogMultiline. Otherwise, pass NULL. | 138 // multiple calls to LogMultiline. Otherwise, pass NULL. |
| 138 void LogMultiline(LoggingSeverity level, const char* label, bool input, | 139 void LogMultiline(LoggingSeverity level, const char* label, bool input, |
| 139 const void* data, size_t len, bool hex_mode, | 140 const void* data, size_t len, bool hex_mode, |
| 140 LogMultilineState* state); | 141 LogMultilineState* state); |
| 141 | 142 |
| 142 // TODO(grunell): Change name to InitDiagnosticLoggingDelegate or | 143 // TODO(grunell): Change name to InitDiagnosticLoggingDelegate or |
| 143 // InitDiagnosticLogging. Change also in init_webrtc.h/cc. | 144 // InitDiagnosticLogging. Change also in init_webrtc.h/cc. |
| 144 // TODO(grunell): typedef the delegate function. | 145 // TODO(grunell): typedef the delegate function. |
| 145 void InitDiagnosticLoggingDelegateFunction( | 146 void InitDiagnosticLoggingDelegateFunction( |
| 146 void (*delegate)(const std::string&)); | 147 void (*delegate)(const std::string&)); |
| 147 | 148 |
| 148 void SetExtraLoggingInit( | 149 void SetExtraLoggingInit( |
| 149 void (*function)(void (*delegate)(const std::string&))); | 150 void (*function)(void (*delegate)(const std::string&))); |
| 150 | 151 |
| 151 } // namespace rtc | 152 } // namespace rtc |
| 152 | 153 |
| 153 #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ | 154 #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_ |
| OLD | NEW |