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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <cassert> | 9 #include <cassert> |
10 #include <string> | 10 #include <string> |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 #define PLOG_STREAM(severity) LOG_GETLASTERROR_STREAM(severity) | 431 #define PLOG_STREAM(severity) LOG_GETLASTERROR_STREAM(severity) |
432 #elif defined(OS_POSIX) | 432 #elif defined(OS_POSIX) |
433 #define LOG_ERRNO_STREAM(severity) \ | 433 #define LOG_ERRNO_STREAM(severity) \ |
434 COMPACT_GOOGLE_LOG_EX_ ## severity(ErrnoLogMessage, \ | 434 COMPACT_GOOGLE_LOG_EX_ ## severity(ErrnoLogMessage, \ |
435 ::logging::GetLastSystemErrorCode()).stream() | 435 ::logging::GetLastSystemErrorCode()).stream() |
436 #define LOG_ERRNO(severity) \ | 436 #define LOG_ERRNO(severity) \ |
437 LAZY_STREAM(LOG_ERRNO_STREAM(severity), LOG_IS_ON(severity)) | 437 LAZY_STREAM(LOG_ERRNO_STREAM(severity), LOG_IS_ON(severity)) |
438 // PLOG_STREAM is used by PLOG, which is the usual error logging macro | 438 // PLOG_STREAM is used by PLOG, which is the usual error logging macro |
439 // for each platform. | 439 // for each platform. |
440 #define PLOG_STREAM(severity) LOG_ERRNO_STREAM(severity) | 440 #define PLOG_STREAM(severity) LOG_ERRNO_STREAM(severity) |
441 // TODO(tschmelcher): Should we add OSStatus logging for Mac? | |
442 #endif | 441 #endif |
443 | 442 |
444 #define PLOG(severity) \ | 443 #define PLOG(severity) \ |
445 LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity)) | 444 LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity)) |
446 | 445 |
447 #define PLOG_IF(severity, condition) \ | 446 #define PLOG_IF(severity, condition) \ |
448 LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) | 447 LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) |
449 | 448 |
450 // http://crbug.com/16512 is open for a real fix for this. For now, Windows | 449 // http://crbug.com/16512 is open for a real fix for this. For now, Windows |
451 // uses OFFICIAL_BUILD and other platforms use the branding flag when NDEBUG is | 450 // uses OFFICIAL_BUILD and other platforms use the branding flag when NDEBUG is |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 #elif NOTIMPLEMENTED_POLICY == 4 | 974 #elif NOTIMPLEMENTED_POLICY == 4 |
976 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG | 975 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG |
977 #elif NOTIMPLEMENTED_POLICY == 5 | 976 #elif NOTIMPLEMENTED_POLICY == 5 |
978 #define NOTIMPLEMENTED() do {\ | 977 #define NOTIMPLEMENTED() do {\ |
979 static int count = 0;\ | 978 static int count = 0;\ |
980 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ | 979 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ |
981 } while(0) | 980 } while(0) |
982 #endif | 981 #endif |
983 | 982 |
984 #endif // BASE_LOGGING_H_ | 983 #endif // BASE_LOGGING_H_ |
OLD | NEW |