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 25 matching lines...) Expand all Loading... |
36 : module(module), | 36 : module(module), |
37 event(event), | 37 event(event), |
38 description(description), | 38 description(description), |
39 time(base::Time::Now()), | 39 time(base::Time::Now()), |
40 count(1) { | 40 count(1) { |
41 } | 41 } |
42 | 42 |
43 std::string LogEntry::ToString() const { | 43 std::string LogEntry::ToString() const { |
44 std::string line; | 44 std::string line; |
45 line += "[" + UTF16ToUTF8(base::TimeFormatShortDateAndTime(time)) + "]"; | 45 line += "[" + UTF16ToUTF8(base::TimeFormatShortDateAndTime(time)) + "]"; |
46 line += " " + module + "." + event; | 46 line += " " + module + ":" + event; |
47 if (!description.empty()) | 47 if (!description.empty()) |
48 line += ": " + description; | 48 line += ": " + description; |
49 if (count > 1) | 49 if (count > 1) |
50 line += StringPrintf(" (%d)", count); | 50 line += StringPrintf(" (%d)", count); |
51 line += "\n"; | 51 line += "\n"; |
52 return line; | 52 return line; |
53 } | 53 } |
54 | 54 |
55 typedef std::deque<LogEntry> LogEntryList; | 55 typedef std::deque<LogEntry> LogEntryList; |
56 | 56 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 std::string GetAsString(StringOrder order, size_t max_events) { | 151 std::string GetAsString(StringOrder order, size_t max_events) { |
152 if (!g_network_event_log) | 152 if (!g_network_event_log) |
153 return "NetworkEventLog not intitialized."; | 153 return "NetworkEventLog not intitialized."; |
154 return g_network_event_log->GetAsString(order, max_events); | 154 return g_network_event_log->GetAsString(order, max_events); |
155 } | 155 } |
156 | 156 |
157 } // namespace network_event_log | 157 } // namespace network_event_log |
158 | 158 |
159 } // namespace chromeos | 159 } // namespace chromeos |
OLD | NEW |