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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 }; | 799 }; |
800 | 800 |
801 SaveLastError last_error_; | 801 SaveLastError last_error_; |
802 #endif | 802 #endif |
803 | 803 |
804 DISALLOW_COPY_AND_ASSIGN(LogMessage); | 804 DISALLOW_COPY_AND_ASSIGN(LogMessage); |
805 }; | 805 }; |
806 | 806 |
807 // A non-macro interface to the log facility; (useful | 807 // A non-macro interface to the log facility; (useful |
808 // when the logging level is not a compile-time constant). | 808 // when the logging level is not a compile-time constant). |
809 inline void LogAtLevel(int const log_level, std::string const &msg) { | 809 inline void LogAtLevel(const int log_level, const std::string& msg) { |
Daniel Erat
2015/09/23 19:20:39
(i don't know why the int parameter was const in t
ki.stfu
2015/09/23 19:48:00
+1
| |
810 LogMessage(__FILE__, __LINE__, log_level).stream() << msg; | 810 LogMessage(__FILE__, __LINE__, log_level).stream() << msg; |
811 } | 811 } |
812 | 812 |
813 // This class is used to explicitly ignore values in the conditional | 813 // This class is used to explicitly ignore values in the conditional |
814 // logging macros. This avoids compiler warnings like "value computed | 814 // logging macros. This avoids compiler warnings like "value computed |
815 // is not used" and "statement has no effect". | 815 // is not used" and "statement has no effect". |
816 class LogMessageVoidify { | 816 class LogMessageVoidify { |
817 public: | 817 public: |
818 LogMessageVoidify() { } | 818 LogMessageVoidify() { } |
819 // This has to be an operator with a precedence lower than << but | 819 // This has to be an operator with a precedence lower than << but |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
964 #elif NOTIMPLEMENTED_POLICY == 5 | 964 #elif NOTIMPLEMENTED_POLICY == 5 |
965 #define NOTIMPLEMENTED() do {\ | 965 #define NOTIMPLEMENTED() do {\ |
966 static bool logged_once = false;\ | 966 static bool logged_once = false;\ |
967 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 967 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
968 logged_once = true;\ | 968 logged_once = true;\ |
969 } while(0);\ | 969 } while(0);\ |
970 EAT_STREAM_PARAMETERS | 970 EAT_STREAM_PARAMETERS |
971 #endif | 971 #endif |
972 | 972 |
973 #endif // BASE_LOGGING_H_ | 973 #endif // BASE_LOGGING_H_ |
OLD | NEW |