diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2014-06-09 16:07:22 +0200 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2014-06-22 16:57:26 +0000 |
commit | 4a3d0b868473260c24aa66f5e3fa737b54a9fd02 (patch) | |
tree | 2123b2b0b6b62ba0967177f860d07c9164e5a9f7 /wiretap/logcat.c | |
parent | 10fc6e253195dced1c00d59e4fbe3d020ecb739d (diff) | |
download | wireshark-4a3d0b868473260c24aa66f5e3fa737b54a9fd02.tar.gz |
Logcat: Fix dump formats
Some dump formats are not exactly what should be done,
so fix them and try to little improve them (mostly by space padding %-8s)
Change-Id: I8ee38479c848abc0a2eaff30ce733e4b60930ac4
Reviewed-on: https://code.wireshark.org/review/2550
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'wiretap/logcat.c')
-rw-r--r-- | wiretap/logcat.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/wiretap/logcat.c b/wiretap/logcat.c index 1aa8058fdd..d6768f8959 100644 --- a/wiretap/logcat.c +++ b/wiretap/logcat.c @@ -63,31 +63,33 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, switch (dumper->type) { case DUMP_BRIEF: - return g_strdup_printf("%c/%s(%5i): %s\n", + return g_strdup_printf("%c/%-8s(%5i): %s\n", priority, tag, pid, log); case DUMP_PROCESS: + /* NOTE: Last parameter should be "process name", not tag; + Unfortunately, we do not have process name */ return g_strdup_printf("%c(%5i) %s (%s)\n", - priority, pid, log, tag); + priority, pid, log, ""); case DUMP_TAG: - return g_strdup_printf("%c/%s: %s\n", + return g_strdup_printf("%c/%-8s: %s\n", priority, tag, log); case DUMP_THREAD: - return g_strdup_printf("%c(%5i:%5i) %s\n", + return g_strdup_printf("%c(%5i:0x%02x) %s\n", priority, pid, tid, log); case DUMP_TIME: strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", gmtime(&datetime)); - return g_strdup_printf("%s.%03i %c/%s(%5i): %s\n", + return g_strdup_printf("%s.%03i %c/%-8s(%5i): %s\n", time_buffer, microseconds, priority, tag, pid, log); case DUMP_THREADTIME: strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", gmtime(&datetime)); - return g_strdup_printf("%s.%03i %5i:%5i %c %s: %s\n", + return g_strdup_printf("%s.%03i %5i %5i %c %-8s: %s\n", time_buffer, microseconds, pid, tid, priority, tag, log); case DUMP_LONG: strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", gmtime(&datetime)); - return g_strdup_printf("[ %s.%03i %5i:%5i %c/%s ]\n%s\n\n", + return g_strdup_printf("[ %s.%03i %5i:0x%02x %c/%s ]\n%s\n\n", time_buffer, microseconds, pid, tid, priority, tag, log); default: return NULL; @@ -380,8 +382,8 @@ static gboolean logcat_dump_text(wtap_dumper *wdh, str_begin = str_end = log; while (dumper->type != DUMP_LONG && (str_end = strchr(str_begin, '\n'))) { log_part = (gchar *) g_malloc(str_end - str_begin + 1); - g_strlcpy(log_part, str_begin, str_end - str_begin); - log_part[str_end - str_begin] = '\0'; + g_strlcpy(log_part, str_begin, str_end - str_begin + 1); +// log_part[str_end - str_begin] = '\0'; str_begin = str_end + 1; buf = logcat_log(dumper, *datetime, *nanoseconds / 1000000, *pid, *tid, @@ -405,8 +407,8 @@ static gboolean logcat_dump_text(wtap_dumper *wdh, if (*str_begin != '\0') { log_part = (gchar *) g_malloc(strlen(str_begin) + 1); - g_strlcpy(log_part, str_begin, strlen(str_begin)); - log_part[strlen(str_begin)] = '\0'; + g_strlcpy(log_part, str_begin, strlen(str_begin) + 1); +// log_part[strlen(str_begin)] = '\0'; buf = logcat_log(dumper, *datetime, *nanoseconds / 1000000, *pid, *tid, priority, tag, log_part); |