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 #ifndef THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 5 #ifndef THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
6 #define THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 6 #define THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 28 matching lines...) Expand all Loading... | |
39 bufsize = 30000; | 39 bufsize = 30000; |
40 base = new char[bufsize]; | 40 base = new char[bufsize]; |
41 } | 41 } |
42 char* p = base; | 42 char* p = base; |
43 char* limit = base + bufsize; | 43 char* limit = base + bufsize; |
44 | 44 |
45 ::base::Time::Exploded t; | 45 ::base::Time::Exploded t; |
46 ::base::Time::Now().LocalExplode(&t); | 46 ::base::Time::Now().LocalExplode(&t); |
47 | 47 |
48 p += ::base::snprintf(p, limit - p, | 48 p += ::base::snprintf(p, limit - p, |
49 "%04d/%02d/%02d-%02d:%02d:%02d.%03d %" PRIu64 " ", | 49 "%04d/%02d/%02d-%02d:%02d:%02d.%03d %llu ", |
cmumford
2014/07/31 20:56:13
On some platforms (OSX I believe) pid_t (PlatformT
Mostyn Bramley-Moore
2014/07/31 21:22:17
(I'll switch to jsbell's suggestion.)
| |
50 t.year, | 50 t.year, |
51 t.month, | 51 t.month, |
52 t.day_of_month, | 52 t.day_of_month, |
53 t.hour, | 53 t.hour, |
54 t.minute, | 54 t.minute, |
55 t.second, | 55 t.second, |
56 t.millisecond, | 56 t.millisecond, |
57 static_cast<long long unsigned int>(thread_id)); | 57 static_cast<long long unsigned int>(thread_id)); |
58 | 58 |
59 // Print the message | 59 // Print the message |
(...skipping 28 matching lines...) Expand all Loading... | |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 private: | 91 private: |
92 FILE* file_; | 92 FILE* file_; |
93 }; | 93 }; |
94 | 94 |
95 } // namespace leveldb | 95 } // namespace leveldb |
96 | 96 |
97 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 97 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
OLD | NEW |