OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
4 * Copyright (C) 2011 University of Szeged. All rights reserved. | 4 * Copyright (C) 2011 University of Szeged. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (current() == this) { | 180 if (current() == this) { |
181 if (m_multiline) | 181 if (m_multiline) |
182 indent(); | 182 indent(); |
183 else | 183 else |
184 print(" "); | 184 print(" "); |
185 print(")\n"); | 185 print(")\n"); |
186 current() = m_parent; | 186 current() = m_parent; |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
| 190 void ScopedLogger::setPrintFuncForTests(PrintFunctionPtr ptr) { |
| 191 m_printFunc = ptr; |
| 192 }; |
| 193 |
190 void ScopedLogger::init(const char* format, va_list args) { | 194 void ScopedLogger::init(const char* format, va_list args) { |
191 current() = this; | 195 current() = this; |
192 if (m_parent) | 196 if (m_parent) |
193 m_parent->writeNewlineIfNeeded(); | 197 m_parent->writeNewlineIfNeeded(); |
194 indent(); | 198 indent(); |
195 print("( "); | 199 print("( "); |
196 m_printFunc(format, args); | 200 m_printFunc(format, args); |
197 } | 201 } |
198 | 202 |
199 void ScopedLogger::writeNewlineIfNeeded() { | 203 void ScopedLogger::writeNewlineIfNeeded() { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 252 |
249 } // namespace WTF | 253 } // namespace WTF |
250 #endif // !LOG_DISABLED | 254 #endif // !LOG_DISABLED |
251 | 255 |
252 void WTFLogAlways(const char* format, ...) { | 256 void WTFLogAlways(const char* format, ...) { |
253 va_list args; | 257 va_list args; |
254 va_start(args, format); | 258 va_start(args, format); |
255 vprintf_stderr_with_trailing_newline(format, args); | 259 vprintf_stderr_with_trailing_newline(format, args); |
256 va_end(args); | 260 va_end(args); |
257 } | 261 } |
OLD | NEW |