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