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

Side by Side Diff: chromeos/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: 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 CHROMEOS_DEVICE_EVENT_LOG_H_ 5 #ifndef CHROMEOS_DEVICE_EVENT_LOG_H_
6 #define CHROMEOS_DEVICE_EVENT_LOG_H_ 6 #define CHROMEOS_DEVICE_EVENT_LOG_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 #define NET_LOG(level) \ 27 #define NET_LOG(level) \
28 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_NETWORK, \ 28 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_NETWORK, \
29 ::chromeos::device_event_log::LOG_LEVEL_##level) 29 ::chromeos::device_event_log::LOG_LEVEL_##level)
30 #define POWER_LOG(level) \ 30 #define POWER_LOG(level) \
31 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_POWER, \ 31 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_POWER, \
32 ::chromeos::device_event_log::LOG_LEVEL_##level) 32 ::chromeos::device_event_log::LOG_LEVEL_##level)
33 #define LOGIN_LOG(level) \ 33 #define LOGIN_LOG(level) \
34 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_LOGIN, \ 34 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_LOGIN, \
35 ::chromeos::device_event_log::LOG_LEVEL_##level) 35 ::chromeos::device_event_log::LOG_LEVEL_##level)
36 #define USB_LOG(level) \
37 DEVICE_LOG(::chromeos::device_event_log::LOG_TYPE_USB, \
38 ::chromeos::device_event_log::LOG_LEVEL_##level)
36 39
37 // Generally prefer the above macros unless |type| or |level| is not constant. 40 // Generally prefer the above macros unless |type| or |level| is not constant.
38 41
39 #define DEVICE_LOG(type, level) \ 42 #define DEVICE_LOG(type, level) \
40 ::chromeos::device_event_log::internal::DeviceEventLogInstance( \ 43 ::chromeos::device_event_log::internal::DeviceEventLogInstance( \
41 __FILE__, __LINE__, type, level).stream() 44 __FILE__, __LINE__, type, level).stream()
42 45
43 // Declare {Type_LOG_IF_SLOW() at the top of a method to log slow methods 46 // Declare {Type_LOG_IF_SLOW() at the top of a method to log slow methods
44 // where "slow" is defined by kSlowMethodThresholdMs in the .cc file. 47 // where "slow" is defined by kSlowMethodThresholdMs in the .cc file.
45 #define SCOPED_NET_LOG_IF_SLOW() \ 48 #define SCOPED_NET_LOG_IF_SLOW() \
(...skipping 10 matching lines...) Expand all
56 // Used to specify the type of event. NOTE: Be sure to update LogTypeFromString 59 // Used to specify the type of event. NOTE: Be sure to update LogTypeFromString
57 // and GetLogTypeString when adding entries to this enum. Also consider 60 // and GetLogTypeString when adding entries to this enum. Also consider
58 // updating chrome://device-log (see device_log_ui.cc). 61 // updating chrome://device-log (see device_log_ui.cc).
59 enum LogType { 62 enum LogType {
60 // Shill / network configuration related events. 63 // Shill / network configuration related events.
61 LOG_TYPE_NETWORK, 64 LOG_TYPE_NETWORK,
62 // Power manager related events. 65 // Power manager related events.
63 LOG_TYPE_POWER, 66 LOG_TYPE_POWER,
64 // Login related events. 67 // Login related events.
65 LOG_TYPE_LOGIN, 68 LOG_TYPE_LOGIN,
69 // USB device related events (i.e. device/usb).
70 LOG_TYPE_USB,
66 // Used internally 71 // Used internally
67 LOG_TYPE_UNKNOWN 72 LOG_TYPE_UNKNOWN
68 }; 73 };
69 74
70 // Used to specify the detail level for logging. In GetAsString, used to 75 // Used to specify the detail level for logging. In GetAsString, used to
71 // specify the maximum detail level (i.e. EVENT will include USER and ERROR). 76 // specify the maximum detail level (i.e. EVENT will include USER and ERROR).
72 // See top-level comment for guidelines for each type. 77 // See top-level comment for guidelines for each type.
73 enum LogLevel { 78 enum LogLevel {
74 LOG_LEVEL_ERROR = 0, 79 LOG_LEVEL_ERROR = 0,
75 LOG_LEVEL_USER = 1, 80 LOG_LEVEL_USER = 1,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 base::ElapsedTimer timer_; 174 base::ElapsedTimer timer_;
170 }; 175 };
171 176
172 } // namespace internal 177 } // namespace internal
173 178
174 } // namespace device_event_log 179 } // namespace device_event_log
175 180
176 } // namespace chromeos 181 } // namespace chromeos
177 182
178 #endif // CHROMEOS_DEVICE_EVENT_LOG_H_ 183 #endif // CHROMEOS_DEVICE_EVENT_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698