Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: chromeos/network/network_event_log.h

Issue 11299236: This moves the ONC parsing code into chromeos/network/onc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit tests Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/chromeos_test_utils.cc ('k') | chromeos/network/network_event_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROMEOS_NETWORK_NETWORK_EVENT_LOG_H_ 5 #ifndef CHROMEOS_NETWORK_NETWORK_EVENT_LOG_H_
6 #define CHROMEOS_NETWORK_NETWORK_EVENT_LOG_H_ 6 #define CHROMEOS_NETWORK_NETWORK_EVENT_LOG_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/stringprintf.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
14 15
15 namespace chromeos { 16 namespace chromeos {
16 17
17 // Namespace for functions for logging network events. 18 // Namespace for functions for logging network events.
18 namespace network_event_log { 19 namespace network_event_log {
19 20
20 // Used to determine which order to output event entries in GetAsString. 21 // Used to determine which order to output event entries in GetAsString.
21 enum StringOrder { 22 enum StringOrder {
(...skipping 16 matching lines...) Expand all
38 // after which new events replace old ones. Does nothing unless Initialize() 39 // after which new events replace old ones. Does nothing unless Initialize()
39 // has been called. 40 // has been called.
40 CHROMEOS_EXPORT void AddEntry(const std::string& module, 41 CHROMEOS_EXPORT void AddEntry(const std::string& module,
41 const std::string& event, 42 const std::string& event,
42 const std::string& description); 43 const std::string& description);
43 44
44 // Outputs the log to a formatted string. |order| determines which order to 45 // Outputs the log to a formatted string. |order| determines which order to
45 // output the events. If |max_events| > 0, limits how many events are output. 46 // output the events. If |max_events| > 0, limits how many events are output.
46 CHROMEOS_EXPORT std::string GetAsString(StringOrder order, size_t max_events); 47 CHROMEOS_EXPORT std::string GetAsString(StringOrder order, size_t max_events);
47 48
49 // Macros to make logging format more consistent.
50 #define NET_LOG(module, message) \
51 ::chromeos::network_event_log::AddEntry( \
52 module, \
53 std::string(__FILE__) + ":" + ::base::StringPrintf("%d",__LINE__) + \
54 " (" + std::string(__func__) + ")", \
55 message)
56
57 #define NET_LOG_WARNING(module, message) \
58 NET_LOG(module, std::string("WARNING:") + message)
59 #define NET_LOG_ERROR(module, message) \
60 NET_LOG(module, std::string("ERROR:") + message)
61
48 } // namespace network_event_log 62 } // namespace network_event_log
49 63
50 } // namespace chromeos 64 } // namespace chromeos
51 65
52 #endif // CHROMEOS_NETWORK_NETWORK_EVENT_LOG_H_ 66 #endif // CHROMEOS_NETWORK_NETWORK_EVENT_LOG_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos_test_utils.cc ('k') | chromeos/network/network_event_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698