OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Only compile this file in debug build. This gives us one more level of | 5 // Only compile this file in debug build. This gives us one more level of |
6 // protection that if the linker tries to link in strings/symbols appended to | 6 // protection that if the linker tries to link in strings/symbols appended to |
7 // "DLOG() <<" in release build (which it shouldn't), we'll get "undefined | 7 // "DLOG() <<" in release build (which it shouldn't), we'll get "undefined |
8 // reference" errors. | 8 // reference" errors. |
9 | 9 |
10 #include "media/cdm/ppapi/cdm_logging.h" | 10 #include "media/cdm/ppapi/cdm_logging.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 stream_ << '['; | 96 stream_ << '['; |
97 | 97 |
98 // Process and thread ID. | 98 // Process and thread ID. |
99 stream_ << CurrentProcessId() << ':'; | 99 stream_ << CurrentProcessId() << ':'; |
100 stream_ << CurrentThreadId() << ':'; | 100 stream_ << CurrentThreadId() << ':'; |
101 | 101 |
102 // Time and tick count. | 102 // Time and tick count. |
103 time_t t = time(NULL); | 103 time_t t = time(NULL); |
104 struct tm local_time = {0}; | 104 struct tm local_time = {0}; |
105 #if _MSC_VER >= 1400 | 105 #ifdef _MSC_VER |
106 localtime_s(&local_time, &t); | 106 localtime_s(&local_time, &t); |
107 #else | 107 #else |
108 localtime_r(&t, &local_time); | 108 localtime_r(&t, &local_time); |
109 #endif | 109 #endif |
110 struct tm* tm_time = &local_time; | 110 struct tm* tm_time = &local_time; |
111 stream_ << std::setfill('0') | 111 stream_ << std::setfill('0') |
112 << std::setw(2) << 1 + tm_time->tm_mon | 112 << std::setw(2) << 1 + tm_time->tm_mon |
113 << std::setw(2) << tm_time->tm_mday | 113 << std::setw(2) << tm_time->tm_mday |
114 << '/' | 114 << '/' |
115 << std::setw(2) << tm_time->tm_hour | 115 << std::setw(2) << tm_time->tm_hour |
(...skipping 18 matching lines...) Expand all Loading... |
134 std::cout << std::endl; | 134 std::cout << std::endl; |
135 } | 135 } |
136 | 136 |
137 #endif // !defined(NDEBUG) | 137 #endif // !defined(NDEBUG) |
138 | 138 |
139 std::ostream& CdmLogStream::stream() { | 139 std::ostream& CdmLogStream::stream() { |
140 return std::cout; | 140 return std::cout; |
141 } | 141 } |
142 | 142 |
143 } // namespace media | 143 } // namespace media |
OLD | NEW |