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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 693 |
694 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) | 694 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) |
695 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) | 695 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) |
696 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) | 696 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) |
697 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2) | 697 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2) |
698 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) | 698 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) |
699 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) | 699 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) |
700 #define DCHECK_IMPLIES(val1, val2) DCHECK(!(val1) || (val2)) | 700 #define DCHECK_IMPLIES(val1, val2) DCHECK(!(val1) || (val2)) |
701 | 701 |
702 #if !DCHECK_IS_ON() && defined(OS_CHROMEOS) | 702 #if !DCHECK_IS_ON() && defined(OS_CHROMEOS) |
703 #define NOTREACHED() LOG(ERROR) << "NOTREACHED() hit in " << \ | 703 // Implement logging of NOTREACHED() as a dedicated function to get function |
704 __FUNCTION__ << ". " | 704 // call overhead down to a minimum. |
| 705 void LogErrorNotReached(const char* file, int line); |
| 706 #define NOTREACHED() \ |
| 707 true ? ::logging::LogErrorNotReached(__FILE__, __LINE__) \ |
| 708 : EAT_STREAM_PARAMETERS |
705 #else | 709 #else |
706 #define NOTREACHED() DCHECK(false) | 710 #define NOTREACHED() DCHECK(false) |
707 #endif | 711 #endif |
708 | 712 |
709 // Redefine the standard assert to use our nice log files | 713 // Redefine the standard assert to use our nice log files |
710 #undef assert | 714 #undef assert |
711 #define assert(x) DLOG_ASSERT(x) | 715 #define assert(x) DLOG_ASSERT(x) |
712 | 716 |
713 // This class more or less represents a particular log message. You | 717 // This class more or less represents a particular log message. You |
714 // create an instance of LogMessage and then stream stuff to it. | 718 // create an instance of LogMessage and then stream stuff to it. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 #elif NOTIMPLEMENTED_POLICY == 5 | 930 #elif NOTIMPLEMENTED_POLICY == 5 |
927 #define NOTIMPLEMENTED() do {\ | 931 #define NOTIMPLEMENTED() do {\ |
928 static bool logged_once = false;\ | 932 static bool logged_once = false;\ |
929 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 933 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
930 logged_once = true;\ | 934 logged_once = true;\ |
931 } while(0);\ | 935 } while(0);\ |
932 EAT_STREAM_PARAMETERS | 936 EAT_STREAM_PARAMETERS |
933 #endif | 937 #endif |
934 | 938 |
935 #endif // BASE_LOGGING_H_ | 939 #endif // BASE_LOGGING_H_ |
OLD | NEW |