| Index: runtime/vm/log.h
|
| diff --git a/runtime/vm/log.h b/runtime/vm/log.h
|
| index f4c58e964cffb4b30c51dbf1a0186b8ab32d4d82..fab7c96c886d0f4d867ed60b8f6c939d4acf7a5a 100644
|
| --- a/runtime/vm/log.h
|
| +++ b/runtime/vm/log.h
|
| @@ -11,26 +11,26 @@
|
|
|
| namespace dart {
|
|
|
| -class Isolate;
|
| class LogBlock;
|
| class Thread;
|
|
|
| #if defined(_MSC_VER)
|
| -#define ISL_Print(format, ...) \
|
| - Isolate::Current()->Log()->Print(format, __VA_ARGS__)
|
| +#define THR_Print(format, ...) \
|
| + Thread::Current()->Log()->Print(format, __VA_ARGS__)
|
| #else
|
| -#define ISL_Print(format, ...) \
|
| - Isolate::Current()->Log()->Print(format, ##__VA_ARGS__)
|
| +#define THR_Print(format, ...) \
|
| + Thread::Current()->Log()->Print(format, ##__VA_ARGS__)
|
| #endif
|
|
|
| -#define ISL_VPrint(format, args) \
|
| - Isolate::Current()->Log()->VPrint(format, args)
|
| +#define THR_VPrint(format, args) \
|
| + Thread::Current()->Log()->VPrint(format, args)
|
|
|
| typedef void (*LogPrinter)(const char* str, ...);
|
|
|
| class Log {
|
| public:
|
| explicit Log(LogPrinter printer = OS::Print);
|
| + ~Log();
|
|
|
| // Append a formatted string to the log.
|
| void Print(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
| @@ -47,6 +47,9 @@ class Log {
|
| // Current cursor.
|
| intptr_t cursor() const;
|
|
|
| + // Returns false if we should drop log messages related to 'isolate'.
|
| + static bool ShouldLogForIsolate(const Isolate* isolate);
|
| +
|
| // A logger that does nothing.
|
| static Log* NoOpLog();
|
|
|
| @@ -70,32 +73,21 @@ class Log {
|
| // Can be nested.
|
| class LogBlock : public StackResource {
|
| public:
|
| - LogBlock(Isolate* isolate, Log* log)
|
| - : StackResource(isolate),
|
| - log_(log), cursor_(log->cursor()) {
|
| - CommonConstructor();
|
| + LogBlock(Thread* thread, Log* log) : StackResource(thread) {
|
| + Initialize(log);
|
| }
|
|
|
| - explicit LogBlock(Isolate* isolate);
|
| - explicit LogBlock(Thread* thread);
|
| -
|
| - LogBlock(Thread* thread, Log* log);
|
| -
|
| - ~LogBlock() {
|
| - CommonDestructor();
|
| + explicit LogBlock(Thread* thread) : StackResource(thread) {
|
| + Initialize(thread->Log());
|
| }
|
|
|
| + ~LogBlock();
|
| +
|
| private:
|
| - void CommonConstructor() {
|
| - log_->EnableManualFlush();
|
| - }
|
| + void Initialize(Log* log);
|
|
|
| - void CommonDestructor() {
|
| - log_->Flush(cursor_);
|
| - log_->DisableManualFlush();
|
| - }
|
| Log* log_;
|
| - const intptr_t cursor_;
|
| + intptr_t cursor_;
|
| };
|
|
|
| } // namespace dart
|
|
|