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