| 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 // This file overrides the logging macros in libjingle (talk/base/logging.h). | 5 // This file overrides the logging macros in libjingle (talk/base/logging.h). |
| 6 // Instead of using libjingle's logging implementation, the libjingle macros are | 6 // Instead of using libjingle's logging implementation, the libjingle macros are |
| 7 // mapped to the corresponding base/logging.h macro (chromium's VLOG). | 7 // mapped to the corresponding base/logging.h macro (chromium's VLOG). |
| 8 // If this file is included outside of libjingle (e.g. in wrapper code) it | 8 // If this file is included outside of libjingle (e.g. in wrapper code) it |
| 9 // should be included after base/logging.h (if any) or compiler error or | 9 // should be included after base/logging.h (if any) or compiler error or |
| 10 // unexpected behavior may occur (macros that have the same name in libjingle as | 10 // unexpected behavior may occur (macros that have the same name in libjingle as |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #define THIRD_PARTY_LIBJINGLE_OVERRIDES_TALK_BASE_LOGGING_H_ | 24 #define THIRD_PARTY_LIBJINGLE_OVERRIDES_TALK_BASE_LOGGING_H_ |
| 25 | 25 |
| 26 #include <sstream> | 26 #include <sstream> |
| 27 #include <string> | 27 #include <string> |
| 28 | 28 |
| 29 #include "base/logging.h" | 29 #include "base/logging.h" |
| 30 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" | 30 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" |
| 31 | 31 |
| 32 namespace talk_base { | 32 namespace talk_base { |
| 33 | 33 |
| 34 class LogMessageDelegate; | |
| 35 | |
| 36 /////////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////////// |
| 37 // ConstantLabel can be used to easily generate string names from constant | 35 // ConstantLabel can be used to easily generate string names from constant |
| 38 // values. This can be useful for logging descriptive names of error messages. | 36 // values. This can be useful for logging descriptive names of error messages. |
| 39 // Usage: | 37 // Usage: |
| 40 // const ConstantLabel LIBRARY_ERRORS[] = { | 38 // const ConstantLabel LIBRARY_ERRORS[] = { |
| 41 // KLABEL(SOME_ERROR), | 39 // KLABEL(SOME_ERROR), |
| 42 // KLABEL(SOME_OTHER_ERROR), | 40 // KLABEL(SOME_OTHER_ERROR), |
| 43 // ... | 41 // ... |
| 44 // LASTLABEL | 42 // LASTLABEL |
| 45 // } | 43 // } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 unprintable_count_[0] = unprintable_count_[1] = 0; | 156 unprintable_count_[0] = unprintable_count_[1] = 0; |
| 159 } | 157 } |
| 160 }; | 158 }; |
| 161 | 159 |
| 162 // When possible, pass optional state variable to track various data across | 160 // When possible, pass optional state variable to track various data across |
| 163 // multiple calls to LogMultiline. Otherwise, pass NULL. | 161 // multiple calls to LogMultiline. Otherwise, pass NULL. |
| 164 void LogMultiline(LoggingSeverity level, const char* label, bool input, | 162 void LogMultiline(LoggingSeverity level, const char* label, bool input, |
| 165 const void* data, size_t len, bool hex_mode, | 163 const void* data, size_t len, bool hex_mode, |
| 166 LogMultilineState* state); | 164 LogMultilineState* state); |
| 167 | 165 |
| 168 // Registers a delegate to receive diagnostic logging messages. Not thread safe, | 166 void InitDiagnosticLoggingDelegateFunction( |
| 169 // must be called from the same thread. | 167 void (*delegate)(const std::string&)); |
| 170 void InitDiagnosticLoggingDelegate(LogMessageDelegate* delegate); | |
| 171 | 168 |
| 172 } // namespace talk_base | 169 } // namespace talk_base |
| 173 | 170 |
| 174 ////////////////////////////////////////////////////////////////////// | 171 ////////////////////////////////////////////////////////////////////// |
| 175 // Libjingle macros which are mapped over to their VLOG equivalent in | 172 // Libjingle macros which are mapped over to their VLOG equivalent in |
| 176 // base/logging.h | 173 // base/logging.h |
| 177 ////////////////////////////////////////////////////////////////////// | 174 ////////////////////////////////////////////////////////////////////// |
| 178 | 175 |
| 179 #if defined(LOGGING_INSIDE_LIBJINGLE) | 176 #if defined(LOGGING_INSIDE_LIBJINGLE) |
| 180 | 177 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 #define LOG_ERR(sev) LOG_ERRNO(sev) | 223 #define LOG_ERR(sev) LOG_ERRNO(sev) |
| 227 #define LAST_SYSTEM_ERROR (errno) | 224 #define LAST_SYSTEM_ERROR (errno) |
| 228 #endif // OS_WIN | 225 #endif // OS_WIN |
| 229 | 226 |
| 230 #undef PLOG | 227 #undef PLOG |
| 231 #define PLOG(sev, err) LOG_ERR_EX(sev, err) | 228 #define PLOG(sev, err) LOG_ERR_EX(sev, err) |
| 232 | 229 |
| 233 #endif // LOGGING_INSIDE_LIBJINGLE | 230 #endif // LOGGING_INSIDE_LIBJINGLE |
| 234 | 231 |
| 235 #endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_TALK_BASE_LOGGING_H_ | 232 #endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_TALK_BASE_LOGGING_H_ |
| OLD | NEW |