diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-10-10 15:25:38 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-12-05 20:14:30 +0000 |
commit | d0bd1b1b58a31c193889eef1b427e9fd3f77b782 (patch) | |
tree | 79566397884f9fcd80c695cb1fe01c1c7b536b84 /logcat | |
parent | a48decd47b6ef8559418c7d1a68739c5ef50aaf8 (diff) | |
download | system_core-d0bd1b1b58a31c193889eef1b427e9fd3f77b782.zip system_core-d0bd1b1b58a31c193889eef1b427e9fd3f77b782.tar.gz system_core-d0bd1b1b58a31c193889eef1b427e9fd3f77b782.tar.bz2 |
logcat: use liblog to determine -b all list
- This is done to prevent the administrivia of adjusting
logcat sources every time a new log id is added.
Change-Id: I0074afb00694c2c00f6c3a66e58c15691146a6c5
Diffstat (limited to 'logcat')
-rw-r--r-- | logcat/logcat.cpp | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp index 6306f5c..79f2ebd 100644 --- a/logcat/logcat.cpp +++ b/logcat/logcat.cpp @@ -455,36 +455,31 @@ int main(int argc, char **argv) delete dev; } - dev = devices = new log_device_t("main", false, 'm'); - android::g_devCount = 1; - if (android_name_to_log_id("system") == LOG_ID_SYSTEM) { - dev->next = new log_device_t("system", false, 's'); - if (dev->next) { - dev = dev->next; - android::g_devCount++; + devices = dev = NULL; + android::g_devCount = 0; + needBinary = false; + for(int i = LOG_ID_MIN; i < LOG_ID_MAX; ++i) { + const char *name = android_log_id_to_name((log_id_t)i); + log_id_t log_id = android_name_to_log_id(name); + + if (log_id != (log_id_t)i) { + continue; } - } - if (android_name_to_log_id("radio") == LOG_ID_RADIO) { - dev->next = new log_device_t("radio", false, 'r'); - if (dev->next) { - dev = dev->next; - android::g_devCount++; + + bool binary = strcmp(name, "events") == 0; + log_device_t* d = new log_device_t(name, binary, *name); + + if (dev) { + dev->next = d; + dev = d; + } else { + devices = dev = d; } - } - if (android_name_to_log_id("events") == LOG_ID_EVENTS) { - dev->next = new log_device_t("events", true, 'e'); - if (dev->next) { - dev = dev->next; - android::g_devCount++; + android::g_devCount++; + if (binary) { needBinary = true; } } - if (android_name_to_log_id("crash") == LOG_ID_CRASH) { - dev->next = new log_device_t("crash", false, 'c'); - if (dev->next) { - android::g_devCount++; - } - } break; } |