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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <cassert> | 10 #include <cassert> |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) | 423 LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) |
424 | 424 |
425 // The actual stream used isn't important. | 425 // The actual stream used isn't important. |
426 #define EAT_STREAM_PARAMETERS \ | 426 #define EAT_STREAM_PARAMETERS \ |
427 true ? (void) 0 : ::logging::LogMessageVoidify() & LOG_STREAM(FATAL) | 427 true ? (void) 0 : ::logging::LogMessageVoidify() & LOG_STREAM(FATAL) |
428 | 428 |
429 // Captures the result of a CHECK_EQ (for example) and facilitates testing as a | 429 // Captures the result of a CHECK_EQ (for example) and facilitates testing as a |
430 // boolean. | 430 // boolean. |
431 class CheckOpResult { | 431 class CheckOpResult { |
432 public: | 432 public: |
433 // |message| must be non-null iff the check failed. | 433 // |message| must be non-null if and only if the check failed. |
434 CheckOpResult(std::string* message) : message_(message) {} | 434 CheckOpResult(std::string* message) : message_(message) {} |
435 // Returns true if the check succeeded. | 435 // Returns true if the check succeeded. |
436 operator bool() const { return !message_; } | 436 operator bool() const { return !message_; } |
437 // Returns the message. | 437 // Returns the message. |
438 std::string* message() { return message_; } | 438 std::string* message() { return message_; } |
439 | 439 |
440 private: | 440 private: |
441 std::string* message_; | 441 std::string* message_; |
442 }; | 442 }; |
443 | 443 |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 #elif NOTIMPLEMENTED_POLICY == 5 | 956 #elif NOTIMPLEMENTED_POLICY == 5 |
957 #define NOTIMPLEMENTED() do {\ | 957 #define NOTIMPLEMENTED() do {\ |
958 static bool logged_once = false;\ | 958 static bool logged_once = false;\ |
959 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 959 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
960 logged_once = true;\ | 960 logged_once = true;\ |
961 } while(0);\ | 961 } while(0);\ |
962 EAT_STREAM_PARAMETERS | 962 EAT_STREAM_PARAMETERS |
963 #endif | 963 #endif |
964 | 964 |
965 #endif // BASE_LOGGING_H_ | 965 #endif // BASE_LOGGING_H_ |
OLD | NEW |