| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 typedef HANDLE FileHandle; | 10 typedef HANDLE FileHandle; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, | 550 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, |
| 551 std::string* result) | 551 std::string* result) |
| 552 : severity_(severity), file_(file), line_(line) { | 552 : severity_(severity), file_(file), line_(line) { |
| 553 Init(file, line); | 553 Init(file, line); |
| 554 stream_ << "Check failed: " << *result; | 554 stream_ << "Check failed: " << *result; |
| 555 delete result; | 555 delete result; |
| 556 } | 556 } |
| 557 | 557 |
| 558 LogMessage::~LogMessage() { | 558 LogMessage::~LogMessage() { |
| 559 // TODO(port): enable stacktrace generation on LOG_FATAL once backtrace are | 559 #if !defined(NDEBUG) && !defined(OS_NACL) |
| 560 // working in Android. | |
| 561 #if !defined(NDEBUG) && !defined(OS_ANDROID) && !defined(OS_NACL) | |
| 562 if (severity_ == LOG_FATAL) { | 560 if (severity_ == LOG_FATAL) { |
| 563 // Include a stack trace on a fatal. | 561 // Include a stack trace on a fatal. |
| 564 base::debug::StackTrace trace; | 562 base::debug::StackTrace trace; |
| 565 stream_ << std::endl; // Newline to separate from log message. | 563 stream_ << std::endl; // Newline to separate from log message. |
| 566 trace.OutputToStream(&stream_); | 564 trace.OutputToStream(&stream_); |
| 567 } | 565 } |
| 568 #endif | 566 #endif |
| 569 stream_ << std::endl; | 567 stream_ << std::endl; |
| 570 std::string str_newline(stream_.str()); | 568 std::string str_newline(stream_.str()); |
| 571 | 569 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 return *log_file_name; | 858 return *log_file_name; |
| 861 return std::wstring(); | 859 return std::wstring(); |
| 862 } | 860 } |
| 863 #endif | 861 #endif |
| 864 | 862 |
| 865 } // namespace logging | 863 } // namespace logging |
| 866 | 864 |
| 867 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 865 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
| 868 return out << WideToUTF8(std::wstring(wstr)); | 866 return out << WideToUTF8(std::wstring(wstr)); |
| 869 } | 867 } |
| OLD | NEW |