summaryrefslogtreecommitdiff
path: root/wiretap
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2014-06-09 16:07:22 +0200
committerMichael Mann <mmann78@netscape.net>2015-05-12 11:37:09 +0000
commit34f5fa585e611ae1471df363333ea4bd7ab2da1c (patch)
tree5ca265566115af504fa48125d44b7829f485339a /wiretap
parent04e948dabc582b300b0e1307380d919c59e47fc5 (diff)
downloadwireshark-34f5fa585e611ae1471df363333ea4bd7ab2da1c.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) Reviewed-on: https://code.wireshark.org/review/2550 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> (cherry picked from commit 4a3d0b868473260c24aa66f5e3fa737b54a9fd02) Change-Id: Id3bc0515fac932594dd8a6759519d3d0182f9252 Reviewed-on: https://code.wireshark.org/review/8345 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/logcat.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/wiretap/logcat.c b/wiretap/logcat.c
index 5bada5bcd6..eba0030508 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);