OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004--2005, Google Inc. | 3 * Copyright 2004--2005, Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // KLABEL(SOME_OTHER_ERROR), | 58 // KLABEL(SOME_OTHER_ERROR), |
59 // ... | 59 // ... |
60 // LASTLABEL | 60 // LASTLABEL |
61 // } | 61 // } |
62 // | 62 // |
63 // int err = LibraryFunc(); | 63 // int err = LibraryFunc(); |
64 // LOG(LS_ERROR) << "LibraryFunc returned: " | 64 // LOG(LS_ERROR) << "LibraryFunc returned: " |
65 // << ErrorName(err, LIBRARY_ERRORS); | 65 // << ErrorName(err, LIBRARY_ERRORS); |
66 | 66 |
67 struct ConstantLabel { int value; const char * label; }; | 67 struct ConstantLabel { int value; const char * label; }; |
| 68 |
| 69 #if defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS) |
68 #define KLABEL(x) { x, #x } | 70 #define KLABEL(x) { x, #x } |
69 #define TLABEL(x,y) { x, y } | 71 #define TLABEL(x,y) { x, y } |
70 #define LASTLABEL { 0, 0 } | 72 #define LASTLABEL { 0, 0 } |
| 73 #endif // defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS) |
71 | 74 |
72 const char * FindLabel(int value, const ConstantLabel entries[]); | 75 const char * FindLabel(int value, const ConstantLabel entries[]); |
73 std::string ErrorName(int err, const ConstantLabel* err_table); | 76 std::string ErrorName(int err, const ConstantLabel* err_table); |
74 | 77 |
75 ////////////////////////////////////////////////////////////////////// | 78 ////////////////////////////////////////////////////////////////////// |
76 | 79 |
77 // Note that the non-standard LoggingSeverity aliases exist because they are | 80 // Note that the non-standard LoggingSeverity aliases exist because they are |
78 // still in broad use. The meanings of the levels are: | 81 // still in broad use. The meanings of the levels are: |
79 // LS_SENSITIVE: Information which should only be logged with the consent | 82 // LS_SENSITIVE: Information which should only be logged with the consent |
80 // of the user, due to privacy concerns. | 83 // of the user, due to privacy concerns. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // multiple calls to LogMultiline. Otherwise, pass NULL. | 189 // multiple calls to LogMultiline. Otherwise, pass NULL. |
187 void LogMultiline(LoggingSeverity level, const char* label, bool input, | 190 void LogMultiline(LoggingSeverity level, const char* label, bool input, |
188 const char * data, size_t len, bool hex_mode, | 191 const char * data, size_t len, bool hex_mode, |
189 LogMultilineState* state); | 192 LogMultilineState* state); |
190 | 193 |
191 ////////////////////////////////////////////////////////////////////// | 194 ////////////////////////////////////////////////////////////////////// |
192 // Macros which automatically disable logging when LOGGING == 0 | 195 // Macros which automatically disable logging when LOGGING == 0 |
193 ////////////////////////////////////////////////////////////////////// | 196 ////////////////////////////////////////////////////////////////////// |
194 | 197 |
195 // If LOGGING is not explicitly defined, default to enabled in debug mode | 198 // If LOGGING is not explicitly defined, default to enabled in debug mode |
| 199 #if defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS) |
196 #if !defined(LOGGING) | 200 #if !defined(LOGGING) |
197 #if defined(_DEBUG) && !defined(NDEBUG) | 201 #if defined(_DEBUG) && !defined(NDEBUG) |
198 #define LOGGING 1 | 202 #define LOGGING 1 |
199 #else | 203 #else |
200 #define LOGGING 0 | 204 #define LOGGING 0 |
201 #endif | 205 #endif |
202 #endif // !defined(LOGGING) | 206 #endif // !defined(LOGGING) |
203 | 207 |
204 #ifndef LOG | 208 #ifndef LOG |
205 #if LOGGING | 209 #if LOGGING |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 #define LOG_GLE(sev) \ | 285 #define LOG_GLE(sev) \ |
282 while (false) talk_base::LogMessage(NULL, 0, talk_base::sev, \ | 286 while (false) talk_base::LogMessage(NULL, 0, talk_base::sev, \ |
283 talk_base::ERRCTX_HRESULT, 0).stream() | 287 talk_base::ERRCTX_HRESULT, 0).stream() |
284 #define LOG_GLEM(sev, mod) \ | 288 #define LOG_GLEM(sev, mod) \ |
285 while (false) talk_base::LogMessage(NULL, 0, talk_base::sev, \ | 289 while (false) talk_base::LogMessage(NULL, 0, talk_base::sev, \ |
286 talk_base::ERRCTX_HRESULT, 0).stream() | 290 talk_base::ERRCTX_HRESULT, 0).stream() |
287 #endif // WIN32 | 291 #endif // WIN32 |
288 | 292 |
289 #endif // !LOGGING | 293 #endif // !LOGGING |
290 #endif // LOG | 294 #endif // LOG |
| 295 #endif // defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS) |
291 | 296 |
292 ////////////////////////////////////////////////////////////////////// | 297 ////////////////////////////////////////////////////////////////////// |
293 | 298 |
294 } // talk_base | 299 } // talk_base |
295 | 300 |
296 #endif // TALK_BASE_LOGGING_H__ | 301 #endif // TALK_BASE_LOGGING_H__ |
OLD | NEW |