| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 #include "src/log-utils.h" | 5 #include "src/log-utils.h" |
| 6 | 6 |
| 7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 #include "src/string-stream.h" | 10 #include "src/string-stream.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (strcmp(log_file_name, kLogToConsole) == 0) { | 48 if (strcmp(log_file_name, kLogToConsole) == 0) { |
| 49 OpenStdout(); | 49 OpenStdout(); |
| 50 } else if (strcmp(log_file_name, kLogToTemporaryFile) == 0) { | 50 } else if (strcmp(log_file_name, kLogToTemporaryFile) == 0) { |
| 51 OpenTemporaryFile(); | 51 OpenTemporaryFile(); |
| 52 } else { | 52 } else { |
| 53 OpenFile(log_file_name); | 53 OpenFile(log_file_name); |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (output_handle_ != nullptr) { | 56 if (output_handle_ != nullptr) { |
| 57 Log::MessageBuilder msg(this); | 57 Log::MessageBuilder msg(this); |
| 58 if (strlen(Version::GetEmbedder()) == 0) { | 58 msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(), |
| 59 msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(), | 59 Version::GetMinor(), Version::GetBuild(), Version::GetPatch(), |
| 60 Version::GetMinor(), Version::GetBuild(), | 60 Version::IsCandidate()); |
| 61 Version::GetPatch(), Version::IsCandidate()); | |
| 62 } else { | |
| 63 msg.Append("v8-version,%d,%d,%d,%d,%s,%d", Version::GetMajor(), | |
| 64 Version::GetMinor(), Version::GetBuild(), | |
| 65 Version::GetPatch(), Version::GetEmbedder(), | |
| 66 Version::IsCandidate()); | |
| 67 } | |
| 68 msg.WriteToLogFile(); | 61 msg.WriteToLogFile(); |
| 69 } | 62 } |
| 70 } | 63 } |
| 71 } | 64 } |
| 72 | 65 |
| 73 | 66 |
| 74 void Log::OpenStdout() { | 67 void Log::OpenStdout() { |
| 75 DCHECK(!IsEnabled()); | 68 DCHECK(!IsEnabled()); |
| 76 output_handle_ = stdout; | 69 output_handle_ = stdout; |
| 77 } | 70 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 const int written = log_->WriteToFile(log_->message_buffer_, pos_); | 235 const int written = log_->WriteToFile(log_->message_buffer_, pos_); |
| 243 if (written != pos_) { | 236 if (written != pos_) { |
| 244 log_->stop(); | 237 log_->stop(); |
| 245 log_->logger_->LogFailure(); | 238 log_->logger_->LogFailure(); |
| 246 } | 239 } |
| 247 } | 240 } |
| 248 | 241 |
| 249 | 242 |
| 250 } // namespace internal | 243 } // namespace internal |
| 251 } // namespace v8 | 244 } // namespace v8 |
| OLD | NEW |