| 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 msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(), | 58 if (strlen(Version::GetEmbedder()) == 0) { |
| 59 Version::GetMinor(), Version::GetBuild(), Version::GetPatch(), | 59 msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(), |
| 60 Version::IsCandidate()); | 60 Version::GetMinor(), Version::GetBuild(), |
| 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 } |
| 61 msg.WriteToLogFile(); | 68 msg.WriteToLogFile(); |
| 62 } | 69 } |
| 63 } | 70 } |
| 64 } | 71 } |
| 65 | 72 |
| 66 | 73 |
| 67 void Log::OpenStdout() { | 74 void Log::OpenStdout() { |
| 68 DCHECK(!IsEnabled()); | 75 DCHECK(!IsEnabled()); |
| 69 output_handle_ = stdout; | 76 output_handle_ = stdout; |
| 70 } | 77 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 const int written = log_->WriteToFile(log_->message_buffer_, pos_); | 242 const int written = log_->WriteToFile(log_->message_buffer_, pos_); |
| 236 if (written != pos_) { | 243 if (written != pos_) { |
| 237 log_->stop(); | 244 log_->stop(); |
| 238 log_->logger_->LogFailure(); | 245 log_->logger_->LogFailure(); |
| 239 } | 246 } |
| 240 } | 247 } |
| 241 | 248 |
| 242 | 249 |
| 243 } // namespace internal | 250 } // namespace internal |
| 244 } // namespace v8 | 251 } // namespace v8 |
| OLD | NEW |