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 #ifndef BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
7 | 7 |
8 #include <cassert> | 8 #include <cassert> |
9 #include <string> | 9 #include <string> |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 COMPACT_GOOGLE_LOG_EX_WARNING(LogMessage) | 323 COMPACT_GOOGLE_LOG_EX_WARNING(LogMessage) |
324 #define COMPACT_GOOGLE_LOG_ERROR \ | 324 #define COMPACT_GOOGLE_LOG_ERROR \ |
325 COMPACT_GOOGLE_LOG_EX_ERROR(LogMessage) | 325 COMPACT_GOOGLE_LOG_EX_ERROR(LogMessage) |
326 #define COMPACT_GOOGLE_LOG_ERROR_REPORT \ | 326 #define COMPACT_GOOGLE_LOG_ERROR_REPORT \ |
327 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(LogMessage) | 327 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(LogMessage) |
328 #define COMPACT_GOOGLE_LOG_FATAL \ | 328 #define COMPACT_GOOGLE_LOG_FATAL \ |
329 COMPACT_GOOGLE_LOG_EX_FATAL(LogMessage) | 329 COMPACT_GOOGLE_LOG_EX_FATAL(LogMessage) |
330 #define COMPACT_GOOGLE_LOG_DFATAL \ | 330 #define COMPACT_GOOGLE_LOG_DFATAL \ |
331 COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage) | 331 COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage) |
332 | 332 |
333 #if defined(OS_WIN) | |
333 // wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets | 334 // wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets |
cpu_(ooo_6.6-7.5)
2012/12/27 23:07:20
so if the workaround is still there for windows, w
| |
334 // substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us | 335 // substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us |
335 // to keep using this syntax, we define this macro to do the same thing | 336 // to keep using this syntax, we define this macro to do the same thing |
336 // as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that | 337 // as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that |
337 // the Windows SDK does for consistency. | 338 // the Windows SDK does for consistency. |
338 #define ERROR 0 | 339 #define ERROR 0 |
339 #define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \ | 340 #define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \ |
340 COMPACT_GOOGLE_LOG_EX_ERROR(ClassName , ##__VA_ARGS__) | 341 COMPACT_GOOGLE_LOG_EX_ERROR(ClassName , ##__VA_ARGS__) |
341 #define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR | 342 #define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR |
342 // Needed for LOG_IS_ON(ERROR). | 343 // Needed for LOG_IS_ON(ERROR). |
343 const LogSeverity LOG_0 = LOG_ERROR; | 344 const LogSeverity LOG_0 = LOG_ERROR; |
345 #endif | |
344 | 346 |
345 // As special cases, we can assume that LOG_IS_ON(ERROR_REPORT) and | 347 // As special cases, we can assume that LOG_IS_ON(ERROR_REPORT) and |
346 // LOG_IS_ON(FATAL) always hold. Also, LOG_IS_ON(DFATAL) always holds | 348 // LOG_IS_ON(FATAL) always hold. Also, LOG_IS_ON(DFATAL) always holds |
347 // in debug mode. In particular, CHECK()s will always fire if they | 349 // in debug mode. In particular, CHECK()s will always fire if they |
348 // fail. | 350 // fail. |
349 #define LOG_IS_ON(severity) \ | 351 #define LOG_IS_ON(severity) \ |
350 ((::logging::LOG_ ## severity) >= ::logging::GetMinLogLevel()) | 352 ((::logging::LOG_ ## severity) >= ::logging::GetMinLogLevel()) |
351 | 353 |
352 // We can't do any caching tricks with VLOG_IS_ON() like the | 354 // We can't do any caching tricks with VLOG_IS_ON() like the |
353 // google-glog version since it requires GCC extensions. This means | 355 // google-glog version since it requires GCC extensions. This means |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 #elif NOTIMPLEMENTED_POLICY == 4 | 979 #elif NOTIMPLEMENTED_POLICY == 4 |
978 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG | 980 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG |
979 #elif NOTIMPLEMENTED_POLICY == 5 | 981 #elif NOTIMPLEMENTED_POLICY == 5 |
980 #define NOTIMPLEMENTED() do {\ | 982 #define NOTIMPLEMENTED() do {\ |
981 static int count = 0;\ | 983 static int count = 0;\ |
982 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ | 984 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ |
983 } while(0) | 985 } while(0) |
984 #endif | 986 #endif |
985 | 987 |
986 #endif // BASE_LOGGING_H_ | 988 #endif // BASE_LOGGING_H_ |
OLD | NEW |