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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, | 558 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, |
559 std::string* result) | 559 std::string* result) |
560 : severity_(severity), file_(file), line_(line) { | 560 : severity_(severity), file_(file), line_(line) { |
561 Init(file, line); | 561 Init(file, line); |
562 stream_ << "Check failed: " << *result; | 562 stream_ << "Check failed: " << *result; |
563 delete result; | 563 delete result; |
564 } | 564 } |
565 | 565 |
566 LogMessage::~LogMessage() { | 566 LogMessage::~LogMessage() { |
567 // TODO(port): enable stacktrace generation on LOG_FATAL once backtrace are | 567 #if !defined(NDEBUG) && !defined(OS_NACL) |
568 // working in Android. | |
569 #if !defined(NDEBUG) && !defined(OS_ANDROID) && !defined(OS_NACL) | |
570 if (severity_ == LOG_FATAL) { | 568 if (severity_ == LOG_FATAL) { |
571 // Include a stack trace on a fatal. | 569 // Include a stack trace on a fatal. |
572 base::debug::StackTrace trace; | 570 base::debug::StackTrace trace; |
573 stream_ << std::endl; // Newline to separate from log message. | 571 stream_ << std::endl; // Newline to separate from log message. |
574 trace.OutputToStream(&stream_); | 572 trace.OutputToStream(&stream_); |
575 } | 573 } |
576 #endif | 574 #endif |
577 stream_ << std::endl; | 575 stream_ << std::endl; |
578 std::string str_newline(stream_.str()); | 576 std::string str_newline(stream_.str()); |
579 | 577 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 return *log_file_name; | 867 return *log_file_name; |
870 return std::wstring(); | 868 return std::wstring(); |
871 } | 869 } |
872 #endif | 870 #endif |
873 | 871 |
874 } // namespace logging | 872 } // namespace logging |
875 | 873 |
876 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 874 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
877 return out << WideToUTF8(std::wstring(wstr)); | 875 return out << WideToUTF8(std::wstring(wstr)); |
878 } | 876 } |
OLD | NEW |