| 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 "chromeos/network/network_event_log.h" | 5 #include "chromeos/network/network_event_log.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 description(description), | 70 description(description), |
| 71 time(base::Time::Now()), | 71 time(base::Time::Now()), |
| 72 count(1) {} | 72 count(1) {} |
| 73 | 73 |
| 74 std::string LogEntry::ToString(bool show_time, | 74 std::string LogEntry::ToString(bool show_time, |
| 75 bool show_file, | 75 bool show_file, |
| 76 bool show_desc, | 76 bool show_desc, |
| 77 bool format_html) const { | 77 bool format_html) const { |
| 78 std::string line; | 78 std::string line; |
| 79 if (show_time) | 79 if (show_time) |
| 80 line += "[" + UTF16ToUTF8(base::TimeFormatTimeOfDay(time)) + "] "; | 80 line += "[" + base::UTF16ToUTF8(base::TimeFormatTimeOfDay(time)) + "] "; |
| 81 if (show_file) { | 81 if (show_file) { |
| 82 std::string filestr = format_html ? net::EscapeForHTML(file) : file; | 82 std::string filestr = format_html ? net::EscapeForHTML(file) : file; |
| 83 line += base::StringPrintf("%s:%d ", file.c_str(), file_line); | 83 line += base::StringPrintf("%s:%d ", file.c_str(), file_line); |
| 84 } | 84 } |
| 85 line += format_html ? GetHtmlText(show_desc) : GetNormalText(show_desc); | 85 line += format_html ? GetHtmlText(show_desc) : GetNormalText(show_desc); |
| 86 if (count > 1) | 86 if (count > 1) |
| 87 line += base::StringPrintf(" (%d)", count); | 87 line += base::StringPrintf(" (%d)", count); |
| 88 return line; | 88 return line; |
| 89 } | 89 } |
| 90 | 90 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 std::string ValueAsString(const base::Value& value) { | 372 std::string ValueAsString(const base::Value& value) { |
| 373 std::string vstr; | 373 std::string vstr; |
| 374 base::JSONWriter::WriteWithOptions( | 374 base::JSONWriter::WriteWithOptions( |
| 375 &value, base::JSONWriter::OPTIONS_OMIT_BINARY_VALUES, &vstr); | 375 &value, base::JSONWriter::OPTIONS_OMIT_BINARY_VALUES, &vstr); |
| 376 return vstr.empty() ? "''" : vstr; | 376 return vstr.empty() ? "''" : vstr; |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace network_event_log | 379 } // namespace network_event_log |
| 380 } // namespace chromeos | 380 } // namespace chromeos |
| OLD | NEW |