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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 536 |
537 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, | 537 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, |
538 std::string* result) | 538 std::string* result) |
539 : severity_(severity), file_(file), line_(line) { | 539 : severity_(severity), file_(file), line_(line) { |
540 Init(file, line); | 540 Init(file, line); |
541 stream_ << "Check failed: " << *result; | 541 stream_ << "Check failed: " << *result; |
542 delete result; | 542 delete result; |
543 } | 543 } |
544 | 544 |
545 LogMessage::~LogMessage() { | 545 LogMessage::~LogMessage() { |
546 #if !defined(NDEBUG) && !defined(OS_NACL) && !defined(__UCLIBC__) | 546 #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) |
547 if (severity_ == LOG_FATAL) { | 547 if (severity_ == LOG_FATAL) { |
548 // Include a stack trace on a fatal. | 548 // Include a stack trace on a fatal. |
549 base::debug::StackTrace trace; | 549 base::debug::StackTrace trace; |
550 stream_ << std::endl; // Newline to separate from log message. | 550 stream_ << std::endl; // Newline to separate from log message. |
551 trace.OutputToStream(&stream_); | 551 trace.OutputToStream(&stream_); |
552 } | 552 } |
553 #endif | 553 #endif |
554 stream_ << std::endl; | 554 stream_ << std::endl; |
555 std::string str_newline(stream_.str()); | 555 std::string str_newline(stream_.str()); |
556 | 556 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { | 812 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { |
813 LogMessage(file, line, LOG_ERROR).stream() | 813 LogMessage(file, line, LOG_ERROR).stream() |
814 << "NOTREACHED() hit."; | 814 << "NOTREACHED() hit."; |
815 } | 815 } |
816 | 816 |
817 } // namespace logging | 817 } // namespace logging |
818 | 818 |
819 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { | 819 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { |
820 return out << base::WideToUTF8(wstr); | 820 return out << base::WideToUTF8(wstr); |
821 } | 821 } |
OLD | NEW |