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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // TODO(darin): It might be nice if the columns were fixed width. | 652 // TODO(darin): It might be nice if the columns were fixed width. |
653 | 653 |
654 stream_ << '['; | 654 stream_ << '['; |
655 if (log_process_id) | 655 if (log_process_id) |
656 stream_ << CurrentProcessId() << ':'; | 656 stream_ << CurrentProcessId() << ':'; |
657 if (log_thread_id) | 657 if (log_thread_id) |
658 stream_ << base::PlatformThread::CurrentId() << ':'; | 658 stream_ << base::PlatformThread::CurrentId() << ':'; |
659 if (log_timestamp) { | 659 if (log_timestamp) { |
660 time_t t = time(NULL); | 660 time_t t = time(NULL); |
661 struct tm local_time = {0}; | 661 struct tm local_time = {0}; |
662 #if _MSC_VER >= 1400 | 662 #ifdef _MSC_VER |
663 localtime_s(&local_time, &t); | 663 localtime_s(&local_time, &t); |
664 #else | 664 #else |
665 localtime_r(&t, &local_time); | 665 localtime_r(&t, &local_time); |
666 #endif | 666 #endif |
667 struct tm* tm_time = &local_time; | 667 struct tm* tm_time = &local_time; |
668 stream_ << std::setfill('0') | 668 stream_ << std::setfill('0') |
669 << std::setw(2) << 1 + tm_time->tm_mon | 669 << std::setw(2) << 1 + tm_time->tm_mon |
670 << std::setw(2) << tm_time->tm_mday | 670 << std::setw(2) << tm_time->tm_mday |
671 << '/' | 671 << '/' |
672 << std::setw(2) << tm_time->tm_hour | 672 << std::setw(2) << tm_time->tm_hour |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 return *log_file_name; | 802 return *log_file_name; |
803 return std::wstring(); | 803 return std::wstring(); |
804 } | 804 } |
805 #endif | 805 #endif |
806 | 806 |
807 } // namespace logging | 807 } // namespace logging |
808 | 808 |
809 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { | 809 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { |
810 return out << base::WideToUTF8(wstr); | 810 return out << base::WideToUTF8(wstr); |
811 } | 811 } |
OLD | NEW |