| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_VM_LOG_H_ | 5 #ifndef RUNTIME_VM_LOG_H_ |
| 6 #define RUNTIME_VM_LOG_H_ | 6 #define RUNTIME_VM_LOG_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class LogBlock; | 14 class LogBlock; |
| 15 class Thread; | 15 class Thread; |
| 16 | 16 |
| 17 #if defined(_MSC_VER) | 17 #if defined(_MSC_VER) |
| 18 #define THR_Print(format, ...) \ | 18 #define THR_Print(format, ...) Log::Current()->Print(format, __VA_ARGS__) |
| 19 Log::Current()->Print(format, __VA_ARGS__) | |
| 20 #else | 19 #else |
| 21 #define THR_Print(format, ...) \ | 20 #define THR_Print(format, ...) Log::Current()->Print(format, ##__VA_ARGS__) |
| 22 Log::Current()->Print(format, ##__VA_ARGS__) | |
| 23 #endif | 21 #endif |
| 24 | 22 |
| 25 #define THR_VPrint(format, args) \ | 23 #define THR_VPrint(format, args) Log::Current()->VPrint(format, args) |
| 26 Log::Current()->VPrint(format, args) | |
| 27 | 24 |
| 28 typedef void (*LogPrinter)(const char* str, ...); | 25 typedef void (*LogPrinter)(const char* str, ...); |
| 29 | 26 |
| 30 class Log { | 27 class Log { |
| 31 public: | 28 public: |
| 32 explicit Log(LogPrinter printer = OS::Print); | 29 explicit Log(LogPrinter printer = OS::Print); |
| 33 ~Log(); | 30 ~Log(); |
| 34 | 31 |
| 35 static Log* Current(); | 32 static Log* Current(); |
| 36 | 33 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 private: | 89 private: |
| 93 void Initialize(); | 90 void Initialize(); |
| 94 | 91 |
| 95 Log* const log_; | 92 Log* const log_; |
| 96 const intptr_t cursor_; | 93 const intptr_t cursor_; |
| 97 }; | 94 }; |
| 98 | 95 |
| 99 } // namespace dart | 96 } // namespace dart |
| 100 | 97 |
| 101 #endif // RUNTIME_VM_LOG_H_ | 98 #endif // RUNTIME_VM_LOG_H_ |
| OLD | NEW |