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 "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 count(1) { | 42 count(1) { |
43 } | 43 } |
44 | 44 |
45 std::string LogEntry::ToString() const { | 45 std::string LogEntry::ToString() const { |
46 std::string line; | 46 std::string line; |
47 line += "[" + UTF16ToUTF8(base::TimeFormatShortDateAndTime(time)) + "]"; | 47 line += "[" + UTF16ToUTF8(base::TimeFormatShortDateAndTime(time)) + "]"; |
48 line += " " + module + ":" + event; | 48 line += " " + module + ":" + event; |
49 if (!description.empty()) | 49 if (!description.empty()) |
50 line += ": " + description; | 50 line += ": " + description; |
51 if (count > 1) | 51 if (count > 1) |
52 line += StringPrintf(" (%d)", count); | 52 line += base::StringPrintf(" (%d)", count); |
53 line += "\n"; | 53 line += "\n"; |
54 return line; | 54 return line; |
55 } | 55 } |
56 | 56 |
57 bool LogEntry::ContentEquals(const LogEntry& other) const { | 57 bool LogEntry::ContentEquals(const LogEntry& other) const { |
58 return module == other.module && | 58 return module == other.module && |
59 event == other.event && | 59 event == other.event && |
60 description == other.description; | 60 description == other.description; |
61 } | 61 } |
62 | 62 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 std::string GetAsString(StringOrder order, size_t max_events) { | 155 std::string GetAsString(StringOrder order, size_t max_events) { |
156 if (!g_network_event_log) | 156 if (!g_network_event_log) |
157 return "NetworkEventLog not intitialized."; | 157 return "NetworkEventLog not intitialized."; |
158 return g_network_event_log->GetAsString(order, max_events); | 158 return g_network_event_log->GetAsString(order, max_events); |
159 } | 159 } |
160 | 160 |
161 } // namespace network_event_log | 161 } // namespace network_event_log |
162 | 162 |
163 } // namespace chromeos | 163 } // namespace chromeos |
OLD | NEW |