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

Side by Side Diff: components/device_event_log/device_event_log.h

Issue 941063003: Log device/usb messages to chrome://device-log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 10 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DEVICE_EVENT_LOG_DEVICE_EVENT_LOG_H_ 5 #ifndef COMPONENTS_DEVICE_EVENT_LOG_DEVICE_EVENT_LOG_H_
6 #define COMPONENTS_DEVICE_EVENT_LOG_DEVICE_EVENT_LOG_H_ 6 #define COMPONENTS_DEVICE_EVENT_LOG_DEVICE_EVENT_LOG_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 #define NET_LOG(level) \ 25 #define NET_LOG(level) \
26 DEVICE_LOG(::device_event_log::LOG_TYPE_NETWORK, \ 26 DEVICE_LOG(::device_event_log::LOG_TYPE_NETWORK, \
27 ::device_event_log::LOG_LEVEL_##level) 27 ::device_event_log::LOG_LEVEL_##level)
28 #define POWER_LOG(level) \ 28 #define POWER_LOG(level) \
29 DEVICE_LOG(::device_event_log::LOG_TYPE_POWER, \ 29 DEVICE_LOG(::device_event_log::LOG_TYPE_POWER, \
30 ::device_event_log::LOG_LEVEL_##level) 30 ::device_event_log::LOG_LEVEL_##level)
31 #define LOGIN_LOG(level) \ 31 #define LOGIN_LOG(level) \
32 DEVICE_LOG(::device_event_log::LOG_TYPE_LOGIN, \ 32 DEVICE_LOG(::device_event_log::LOG_TYPE_LOGIN, \
33 ::device_event_log::LOG_LEVEL_##level) 33 ::device_event_log::LOG_LEVEL_##level)
34 #define USB_LOG(level) \
35 DEVICE_LOG(::device_event_log::LOG_TYPE_USB, \
36 ::device_event_log::LOG_LEVEL_##level)
34 37
35 // Generally prefer the above macros unless |type| or |level| is not constant. 38 // Generally prefer the above macros unless |type| or |level| is not constant.
36 39
37 #define DEVICE_LOG(type, level) \ 40 #define DEVICE_LOG(type, level) \
38 ::device_event_log::internal::DeviceEventLogInstance(__FILE__, __LINE__, \ 41 ::device_event_log::internal::DeviceEventLogInstance(__FILE__, __LINE__, \
39 type, level).stream() 42 type, level).stream()
40 43
41 // Declare {Type_LOG_IF_SLOW() at the top of a method to log slow methods 44 // Declare {Type_LOG_IF_SLOW() at the top of a method to log slow methods
42 // where "slow" is defined by kSlowMethodThresholdMs in the .cc file. 45 // where "slow" is defined by kSlowMethodThresholdMs in the .cc file.
43 #define SCOPED_NET_LOG_IF_SLOW() \ 46 #define SCOPED_NET_LOG_IF_SLOW() \
(...skipping 10 matching lines...) Expand all
54 // Used to specify the type of event. NOTE: Be sure to update LogTypeFromString 57 // Used to specify the type of event. NOTE: Be sure to update LogTypeFromString
55 // and GetLogTypeString when adding entries to this enum. Also consider 58 // and GetLogTypeString when adding entries to this enum. Also consider
56 // updating chrome://device-log (see device_log_ui.cc). 59 // updating chrome://device-log (see device_log_ui.cc).
57 enum LogType { 60 enum LogType {
58 // Shill / network configuration related events. 61 // Shill / network configuration related events.
59 LOG_TYPE_NETWORK, 62 LOG_TYPE_NETWORK,
60 // Power manager related events. 63 // Power manager related events.
61 LOG_TYPE_POWER, 64 LOG_TYPE_POWER,
62 // Login related events. 65 // Login related events.
63 LOG_TYPE_LOGIN, 66 LOG_TYPE_LOGIN,
67 // USB device related events (i.e. device/usb).
68 LOG_TYPE_USB,
64 // Used internally 69 // Used internally
65 LOG_TYPE_UNKNOWN 70 LOG_TYPE_UNKNOWN
66 }; 71 };
67 72
68 // Used to specify the detail level for logging. In GetAsString, used to 73 // Used to specify the detail level for logging. In GetAsString, used to
69 // specify the maximum detail level (i.e. EVENT will include USER and ERROR). 74 // specify the maximum detail level (i.e. EVENT will include USER and ERROR).
70 // See top-level comment for guidelines for each type. 75 // See top-level comment for guidelines for each type.
71 enum LogLevel { 76 enum LogLevel {
72 LOG_LEVEL_ERROR = 0, 77 LOG_LEVEL_ERROR = 0,
73 LOG_LEVEL_USER = 1, 78 LOG_LEVEL_USER = 1,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 LogType type_; 171 LogType type_;
167 std::string name_; 172 std::string name_;
168 base::ElapsedTimer timer_; 173 base::ElapsedTimer timer_;
169 }; 174 };
170 175
171 } // namespace internal 176 } // namespace internal
172 177
173 } // namespace device_event_log 178 } // namespace device_event_log
174 179
175 #endif // DEVICE_EVENT_LOG_DEVICE_EVENT_LOG_H_ 180 #endif // DEVICE_EVENT_LOG_DEVICE_EVENT_LOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/device_log_ui.cc ('k') | components/device_event_log/device_event_log_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698