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 <stdint.h> |
| 9 |
8 #include "base/files/file.h" | 10 #include "base/files/file.h" |
9 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
12 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 14 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
13 | 15 |
14 namespace leveldb { | 16 namespace leveldb { |
15 | 17 |
16 class ChromiumLogger : public Logger { | 18 class ChromiumLogger : public Logger { |
17 public: | 19 public: |
(...skipping 23 matching lines...) Expand all Loading... |
41 | 43 |
42 p += base::snprintf(p, limit - p, | 44 p += base::snprintf(p, limit - p, |
43 "%04d/%02d/%02d-%02d:%02d:%02d.%03d %" PRIu64 " ", | 45 "%04d/%02d/%02d-%02d:%02d:%02d.%03d %" PRIu64 " ", |
44 t.year, | 46 t.year, |
45 t.month, | 47 t.month, |
46 t.day_of_month, | 48 t.day_of_month, |
47 t.hour, | 49 t.hour, |
48 t.minute, | 50 t.minute, |
49 t.second, | 51 t.second, |
50 t.millisecond, | 52 t.millisecond, |
51 static_cast<uint64>(thread_id)); | 53 static_cast<uint64_t>(thread_id)); |
52 | 54 |
53 // Print the message | 55 // Print the message |
54 if (p < limit) { | 56 if (p < limit) { |
55 va_list backup_ap; | 57 va_list backup_ap; |
56 va_copy(backup_ap, ap); | 58 va_copy(backup_ap, ap); |
57 p += vsnprintf(p, limit - p, format, backup_ap); | 59 p += vsnprintf(p, limit - p, format, backup_ap); |
58 va_end(backup_ap); | 60 va_end(backup_ap); |
59 } | 61 } |
60 | 62 |
61 // Truncate to available space if necessary | 63 // Truncate to available space if necessary |
(...skipping 19 matching lines...) Expand all Loading... |
81 } | 83 } |
82 } | 84 } |
83 | 85 |
84 private: | 86 private: |
85 scoped_ptr<base::File> file_; | 87 scoped_ptr<base::File> file_; |
86 }; | 88 }; |
87 | 89 |
88 } // namespace leveldb | 90 } // namespace leveldb |
89 | 91 |
90 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 92 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
OLD | NEW |