OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 } | 554 } |
555 if (log_tickcount) | 555 if (log_tickcount) |
556 stream_ << TickCount() << ':'; | 556 stream_ << TickCount() << ':'; |
557 stream_ << log_severity_names[severity_] << ":" << file << | 557 stream_ << log_severity_names[severity_] << ":" << file << |
558 "(" << line << ")] "; | 558 "(" << line << ")] "; |
559 | 559 |
560 message_start_ = stream_.tellp(); | 560 message_start_ = stream_.tellp(); |
561 } | 561 } |
562 | 562 |
563 LogMessage::~LogMessage() { | 563 LogMessage::~LogMessage() { |
564 // The macros in logging.h should already avoid creating LogMessages | 564 // TODO(brettw) modify the macros so that nothing is executed when the log |
565 // when this holds, but it's possible that users create LogMessages | 565 // level is too high. |
566 // directly (e.g., using LOG_STREAM() directly). | |
567 if (severity_ < min_log_level) | 566 if (severity_ < min_log_level) |
568 return; | 567 return; |
569 | 568 |
570 #ifndef NDEBUG | 569 #ifndef NDEBUG |
571 if (severity_ == LOG_FATAL) { | 570 if (severity_ == LOG_FATAL) { |
572 // Include a stack trace on a fatal. | 571 // Include a stack trace on a fatal. |
573 StackTrace trace; | 572 StackTrace trace; |
574 stream_ << std::endl; // Newline to separate from log message. | 573 stream_ << std::endl; // Newline to separate from log message. |
575 trace.OutputToStream(&stream_); | 574 trace.OutputToStream(&stream_); |
576 } | 575 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 | 782 |
784 if (level == LOG_FATAL) | 783 if (level == LOG_FATAL) |
785 DebugUtil::BreakDebugger(); | 784 DebugUtil::BreakDebugger(); |
786 } | 785 } |
787 | 786 |
788 } // namespace logging | 787 } // namespace logging |
789 | 788 |
790 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 789 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
791 return out << WideToUTF8(std::wstring(wstr)); | 790 return out << WideToUTF8(std::wstring(wstr)); |
792 } | 791 } |
OLD | NEW |