OLD | NEW |
(Empty) | |
| 1 # Device Event Log |
| 2 |
| 3 This directory contains code for logging device and system events. |
| 4 |
| 5 ## Usage |
| 6 |
| 7 Use device event log macros to record events without contributing to noise in |
| 8 the chrome log. |
| 9 |
| 10 * Events are stored in a circular buffer (current limit is 4000). |
| 11 * Events can be viewed at chrome://device-log. Events can be filtered by type |
| 12 and level. |
| 13 * Events show up in **feedback reports** under `device_event_log`. |
| 14 * Network events are separated out into a `network_event_log` section. |
| 15 * **ERROR** events will also be logged to the main chrome log. |
| 16 * All events can be logged to the main chrome log using vlog: |
| 17 `--vmodule=device_event_log*=1` |
| 18 |
| 19 The events can also be queried for viewing in other informational pages, e.g: |
| 20 ``` |
| 21 device_event_log::GetAsString(device_event_log::OLDEST_FIRST, "json", |
| 22 "bluetooth", device_event_log::LOG_LEVEL_DEBUG, |
| 23 1000); |
| 24 ``` |
| 25 |
| 26 ## Examples |
| 27 |
| 28 Typical usage: |
| 29 |
| 30 ```NET_LOG(EVENT) << "NetworkState Changed " << name << ": " << state;``` |
| 31 |
| 32 ```POWER_LOG(USER) << "Suspend requested";``` |
| 33 |
| 34 ```POWER_LOG(DEBUG) << "Sending suspend request to dbus object: " << path;``` |
| 35 |
| 36 ```BLUETOOTH_LOG(ERROR) << "Unrecognized DBus error " << error_name;``` |
| 37 |
| 38 Advanced usage: |
| 39 |
| 40 ``` |
| 41 device_event_log::LogLevel log_level = |
| 42 SuppressError(dbus_error_message) ? device_event_log::LOG_LEVEL_DEBUG |
| 43 : device_event_log::LOG_LEVEL_ERROR; |
| 44 DEVICE_LOG(device_event_log::LOG_TYPE_NETWORK, log_level) << detail; |
| 45 ``` |
| 46 |
| 47 ``` |
| 48 USB_PLOG(DEBUG) << "Failed to set configuration " << configuration_value; |
| 49 ``` |
OLD | NEW |