OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 // Need to include this before most other files because it defines | 7 // Need to include this before most other files because it defines |
8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the | 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the |
10 // ViewMsgLog et al. functions. | 10 // ViewMsgLog et al. functions. |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 std::ifstream log_file; | 429 std::ifstream log_file; |
430 log_file.open(GetLogFileName().value().c_str()); | 430 log_file.open(GetLogFileName().value().c_str()); |
431 if (!log_file.is_open()) | 431 if (!log_file.is_open()) |
432 return 0; | 432 return 0; |
433 | 433 |
434 std::string utf8_line; | 434 std::string utf8_line; |
435 std::wstring wide_line; | 435 std::wstring wide_line; |
436 while (!log_file.eof()) { | 436 while (!log_file.eof()) { |
437 getline(log_file, utf8_line); | 437 getline(log_file, utf8_line); |
438 if (utf8_line.find(":FATAL:") != std::string::npos) { | 438 if (utf8_line.find(":FATAL:") != std::string::npos) { |
439 wide_line = UTF8ToWide(utf8_line); | 439 wide_line = base::UTF8ToWide(utf8_line); |
440 if (assertions) | 440 if (assertions) |
441 assertions->push_back(wide_line); | 441 assertions->push_back(wide_line); |
442 ++assertion_count; | 442 ++assertion_count; |
443 } | 443 } |
444 } | 444 } |
445 log_file.close(); | 445 log_file.close(); |
446 | 446 |
447 return assertion_count; | 447 return assertion_count; |
448 } | 448 } |
449 | 449 |
450 base::FilePath GenerateTimestampedName(const base::FilePath& base_path, | 450 base::FilePath GenerateTimestampedName(const base::FilePath& base_path, |
451 base::Time timestamp) { | 451 base::Time timestamp) { |
452 base::Time::Exploded time_deets; | 452 base::Time::Exploded time_deets; |
453 timestamp.LocalExplode(&time_deets); | 453 timestamp.LocalExplode(&time_deets); |
454 std::string suffix = base::StringPrintf("_%02d%02d%02d-%02d%02d%02d", | 454 std::string suffix = base::StringPrintf("_%02d%02d%02d-%02d%02d%02d", |
455 time_deets.year, | 455 time_deets.year, |
456 time_deets.month, | 456 time_deets.month, |
457 time_deets.day_of_month, | 457 time_deets.day_of_month, |
458 time_deets.hour, | 458 time_deets.hour, |
459 time_deets.minute, | 459 time_deets.minute, |
460 time_deets.second); | 460 time_deets.second); |
461 return base_path.InsertBeforeExtensionASCII(suffix); | 461 return base_path.InsertBeforeExtensionASCII(suffix); |
462 } | 462 } |
463 | 463 |
464 } // namespace logging | 464 } // namespace logging |
OLD | NEW |