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 "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 t.day_of_month, | 47 t.day_of_month, |
48 t.hour, | 48 t.hour, |
49 t.minute, | 49 t.minute, |
50 t.second, | 50 t.second, |
51 t.millisecond, | 51 t.millisecond, |
52 static_cast<uint64>(thread_id)); | 52 static_cast<uint64>(thread_id)); |
53 | 53 |
54 // Print the message | 54 // Print the message |
55 if (p < limit) { | 55 if (p < limit) { |
56 va_list backup_ap; | 56 va_list backup_ap; |
57 GG_VA_COPY(backup_ap, ap); | 57 va_copy(backup_ap, ap); |
58 p += vsnprintf(p, limit - p, format, backup_ap); | 58 p += vsnprintf(p, limit - p, format, backup_ap); |
59 va_end(backup_ap); | 59 va_end(backup_ap); |
60 } | 60 } |
61 | 61 |
62 // Truncate to available space if necessary | 62 // Truncate to available space if necessary |
63 if (p >= limit) { | 63 if (p >= limit) { |
64 if (iter == 0) { | 64 if (iter == 0) { |
65 continue; // Try again with larger buffer | 65 continue; // Try again with larger buffer |
66 } else { | 66 } else { |
67 p = limit - 1; | 67 p = limit - 1; |
(...skipping 14 matching lines...) Expand all Loading... |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 private: | 85 private: |
86 scoped_ptr<base::File> file_; | 86 scoped_ptr<base::File> file_; |
87 }; | 87 }; |
88 | 88 |
89 } // namespace leveldb | 89 } // namespace leveldb |
90 | 90 |
91 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 91 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
OLD | NEW |