Chromium Code Reviews| 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 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 855 #endif // defined(OS_WIN) | 855 #endif // defined(OS_WIN) |
| 856 | 856 |
| 857 void CloseLogFile() { | 857 void CloseLogFile() { |
| 858 #if !defined(OS_WIN) | 858 #if !defined(OS_WIN) |
| 859 LoggingLock logging_lock; | 859 LoggingLock logging_lock; |
| 860 #endif | 860 #endif |
| 861 CloseLogFileUnlocked(); | 861 CloseLogFileUnlocked(); |
| 862 } | 862 } |
| 863 | 863 |
| 864 void RawLog(int level, const char* message) { | 864 void RawLog(int level, const char* message) { |
| 865 if (level >= g_min_log_level) { | 865 if (level >= g_min_log_level && message) { |
| 866 size_t bytes_written = 0; | 866 size_t bytes_written = 0; |
| 867 const size_t message_len = strlen(message); | 867 const size_t message_len = strlen(message); |
| 868 int rv; | 868 int rv; |
| 869 while (bytes_written < message_len) { | 869 while (bytes_written < message_len) { |
| 870 rv = HANDLE_EINTR( | 870 rv = HANDLE_EINTR( |
| 871 write(STDERR_FILENO, message + bytes_written, | 871 write(STDERR_FILENO, message + bytes_written, |
| 872 message_len - bytes_written)); | 872 message_len - bytes_written)); |
| 873 if (rv < 0) { | 873 if (rv < 0) { |
| 874 // Give up, nothing we can do now. | 874 // Give up, nothing we can do now. |
| 875 break; | 875 break; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 #endif | 908 #endif |
| 909 | 909 |
| 910 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { | 910 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { |
| 911 LogMessage(file, line, LOG_ERROR).stream() | 911 LogMessage(file, line, LOG_ERROR).stream() |
| 912 << "NOTREACHED() hit."; | 912 << "NOTREACHED() hit."; |
| 913 } | 913 } |
| 914 | 914 |
| 915 } // namespace logging | 915 } // namespace logging |
| 916 | 916 |
| 917 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { | 917 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { |
| 918 return out << base::WideToUTF8(wstr); | 918 return out << (wstr ? base::WideToUTF8(wstr) : std::string()); |
|
Mark Mentovai
2016/03/10 18:06:54
Your description only mentions RawLog(). Make it a
| |
| 919 } | 919 } |
| OLD | NEW |