| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 LogMessage(const char* file, int line, std::string* result); | 761 LogMessage(const char* file, int line, std::string* result); |
| 762 | 762 |
| 763 // Used for DCHECK_EQ(), etc. Takes ownership of the given string. | 763 // Used for DCHECK_EQ(), etc. Takes ownership of the given string. |
| 764 LogMessage(const char* file, int line, LogSeverity severity, | 764 LogMessage(const char* file, int line, LogSeverity severity, |
| 765 std::string* result); | 765 std::string* result); |
| 766 | 766 |
| 767 ~LogMessage(); | 767 ~LogMessage(); |
| 768 | 768 |
| 769 std::ostream& stream() { return stream_; } | 769 std::ostream& stream() { return stream_; } |
| 770 | 770 |
| 771 LogSeverity severity() { return severity_; } |
| 772 std::string str() { return stream_.str(); } |
| 773 |
| 771 private: | 774 private: |
| 772 void Init(const char* file, int line); | 775 void Init(const char* file, int line); |
| 773 | 776 |
| 774 LogSeverity severity_; | 777 LogSeverity severity_; |
| 775 std::ostringstream stream_; | 778 std::ostringstream stream_; |
| 776 size_t message_start_; // Offset of the start of the message (past prefix | 779 size_t message_start_; // Offset of the start of the message (past prefix |
| 777 // info). | 780 // info). |
| 778 // The file and line information passed in to the constructor. | 781 // The file and line information passed in to the constructor. |
| 779 const char* file_; | 782 const char* file_; |
| 780 const int line_; | 783 const int line_; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 #elif NOTIMPLEMENTED_POLICY == 5 | 959 #elif NOTIMPLEMENTED_POLICY == 5 |
| 957 #define NOTIMPLEMENTED() do {\ | 960 #define NOTIMPLEMENTED() do {\ |
| 958 static bool logged_once = false;\ | 961 static bool logged_once = false;\ |
| 959 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 962 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
| 960 logged_once = true;\ | 963 logged_once = true;\ |
| 961 } while(0);\ | 964 } while(0);\ |
| 962 EAT_STREAM_PARAMETERS | 965 EAT_STREAM_PARAMETERS |
| 963 #endif | 966 #endif |
| 964 | 967 |
| 965 #endif // BASE_LOGGING_H_ | 968 #endif // BASE_LOGGING_H_ |
| OLD | NEW |