OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project 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 V8_LOG_UTILS_H_ | 5 #ifndef V8_LOG_UTILS_H_ |
6 #define V8_LOG_UTILS_H_ | 6 #define V8_LOG_UTILS_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include <cstdarg> | 10 #include <cstdarg> |
11 | 11 |
12 #include "src/allocation.h" | 12 #include "src/allocation.h" |
| 13 #include "src/base/compiler-specific.h" |
13 #include "src/base/platform/mutex.h" | 14 #include "src/base/platform/mutex.h" |
14 #include "src/flags.h" | 15 #include "src/flags.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 class Logger; | 20 class Logger; |
20 | 21 |
21 // Functions and data for performing output of log messages. | 22 // Functions and data for performing output of log messages. |
22 class Log { | 23 class Log { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Utility class for formatting log messages. It fills the message into the | 56 // Utility class for formatting log messages. It fills the message into the |
56 // static buffer in Log. | 57 // static buffer in Log. |
57 class MessageBuilder BASE_EMBEDDED { | 58 class MessageBuilder BASE_EMBEDDED { |
58 public: | 59 public: |
59 // Create a message builder starting from position 0. | 60 // Create a message builder starting from position 0. |
60 // This acquires the mutex in the log as well. | 61 // This acquires the mutex in the log as well. |
61 explicit MessageBuilder(Log* log); | 62 explicit MessageBuilder(Log* log); |
62 ~MessageBuilder() { } | 63 ~MessageBuilder() { } |
63 | 64 |
64 // Append string data to the log message. | 65 // Append string data to the log message. |
65 void Append(const char* format, ...); | 66 void PRINTF_FORMAT(2, 3) Append(const char* format, ...); |
66 | 67 |
67 // Append string data to the log message. | 68 // Append string data to the log message. |
68 void AppendVA(const char* format, va_list args); | 69 void PRINTF_FORMAT(2, 0) AppendVA(const char* format, va_list args); |
69 | 70 |
70 // Append a character to the log message. | 71 // Append a character to the log message. |
71 void Append(const char c); | 72 void Append(const char c); |
72 | 73 |
73 // Append double quoted string to the log message. | 74 // Append double quoted string to the log message. |
74 void AppendDoubleQuotedString(const char* string); | 75 void AppendDoubleQuotedString(const char* string); |
75 | 76 |
76 // Append a heap string. | 77 // Append a heap string. |
77 void Append(String* str); | 78 void Append(String* str); |
78 | 79 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 Logger* logger_; | 136 Logger* logger_; |
136 | 137 |
137 friend class Logger; | 138 friend class Logger; |
138 }; | 139 }; |
139 | 140 |
140 | 141 |
141 } // namespace internal | 142 } // namespace internal |
142 } // namespace v8 | 143 } // namespace v8 |
143 | 144 |
144 #endif // V8_LOG_UTILS_H_ | 145 #endif // V8_LOG_UTILS_H_ |
OLD | NEW |