| 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 #include "vm/log.h" | 5 #include "vm/log.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/thread.h" | 8 #include "vm/thread.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 DEFINE_FLAG(bool, force_log_flush, false, "Always flush log messages."); | 12 DEFINE_FLAG(bool, force_log_flush, false, "Always flush log messages."); |
| 13 | 13 |
| 14 DEFINE_FLAG(charp, isolate_log_filter, NULL, | 14 DEFINE_FLAG(charp, |
| 15 isolate_log_filter, |
| 16 NULL, |
| 15 "Log isolates whose name include the filter. " | 17 "Log isolates whose name include the filter. " |
| 16 "Default: service isolate log messages are suppressed " | 18 "Default: service isolate log messages are suppressed " |
| 17 "(specify 'vm-service' to log them)."); | 19 "(specify 'vm-service' to log them)."); |
| 18 | 20 |
| 19 Log::Log(LogPrinter printer) | 21 Log::Log(LogPrinter printer) |
| 20 : printer_(printer), | 22 : printer_(printer), manual_flush_(0), buffer_(0) {} |
| 21 manual_flush_(0), | |
| 22 buffer_(0) { | |
| 23 } | |
| 24 | 23 |
| 25 | 24 |
| 26 Log::~Log() { | 25 Log::~Log() { |
| 27 // Did someone enable manual flushing and then forgot to Flush? | 26 // Did someone enable manual flushing and then forgot to Flush? |
| 28 ASSERT(cursor() == 0); | 27 ASSERT(cursor() == 0); |
| 29 } | 28 } |
| 30 | 29 |
| 31 | 30 |
| 32 Log* Log::Current() { | 31 Log* Log::Current() { |
| 33 Thread* thread = Thread::Current(); | 32 Thread* thread = Thread::Current(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 log_->EnableManualFlush(); | 177 log_->EnableManualFlush(); |
| 179 } | 178 } |
| 180 | 179 |
| 181 | 180 |
| 182 LogBlock::~LogBlock() { | 181 LogBlock::~LogBlock() { |
| 183 log_->Flush(cursor_); | 182 log_->Flush(cursor_); |
| 184 log_->DisableManualFlush(); | 183 log_->DisableManualFlush(); |
| 185 } | 184 } |
| 186 | 185 |
| 187 } // namespace dart | 186 } // namespace dart |
| OLD | NEW |