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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // and the other is NULL. To work around this, simply static_cast NULL to the | 769 // and the other is NULL. To work around this, simply static_cast NULL to the |
770 // type of the desired pointer. | 770 // type of the desired pointer. |
771 | 771 |
772 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) | 772 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) |
773 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) | 773 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) |
774 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) | 774 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) |
775 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2) | 775 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2) |
776 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) | 776 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) |
777 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) | 777 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) |
778 | 778 |
| 779 #if defined(NDEBUG) && defined(OS_CHROMEOS) |
| 780 #define NOTREACHED() LOG(ERROR) << "NOTREACHED() hit in " << \ |
| 781 __FUNCTION__ << ". " |
| 782 #else |
779 #define NOTREACHED() DCHECK(false) | 783 #define NOTREACHED() DCHECK(false) |
| 784 #endif |
780 | 785 |
781 // Redefine the standard assert to use our nice log files | 786 // Redefine the standard assert to use our nice log files |
782 #undef assert | 787 #undef assert |
783 #define assert(x) DLOG_ASSERT(x) | 788 #define assert(x) DLOG_ASSERT(x) |
784 | 789 |
785 // This class more or less represents a particular log message. You | 790 // This class more or less represents a particular log message. You |
786 // create an instance of LogMessage and then stream stuff to it. | 791 // create an instance of LogMessage and then stream stuff to it. |
787 // When you finish streaming to it, ~LogMessage is called and the | 792 // When you finish streaming to it, ~LogMessage is called and the |
788 // full message gets streamed to the appropriate destination. | 793 // full message gets streamed to the appropriate destination. |
789 // | 794 // |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 #elif NOTIMPLEMENTED_POLICY == 5 | 1018 #elif NOTIMPLEMENTED_POLICY == 5 |
1014 #define NOTIMPLEMENTED() do {\ | 1019 #define NOTIMPLEMENTED() do {\ |
1015 static bool logged_once = false;\ | 1020 static bool logged_once = false;\ |
1016 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 1021 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
1017 logged_once = true;\ | 1022 logged_once = true;\ |
1018 } while(0);\ | 1023 } while(0);\ |
1019 EAT_STREAM_PARAMETERS | 1024 EAT_STREAM_PARAMETERS |
1020 #endif | 1025 #endif |
1021 | 1026 |
1022 #endif // BASE_LOGGING_H_ | 1027 #endif // BASE_LOGGING_H_ |
OLD | NEW |