diff options
| author | Mark Salyzyn <salyzyn@google.com> | 2013-12-18 12:59:01 -0800 |
|---|---|---|
| committer | Mark Salyzyn <salyzyn@google.com> | 2014-01-27 15:21:29 -0800 |
| commit | 40b21558e52e9245929495c5344443276e5d87c1 (patch) | |
| tree | cabe4a625f6e09caea68cdc0af31a57e1d55576c /liblog | |
| parent | e7ff525a7e8c2109439260c2ac898fc3cc17e011 (diff) | |
| download | system_core-40b21558e52e9245929495c5344443276e5d87c1.tar.gz system_core-40b21558e52e9245929495c5344443276e5d87c1.tar.bz2 system_core-40b21558e52e9245929495c5344443276e5d87c1.zip | |
liblog: support struct logger_event_v2 format
(cherry picked from commit c176e14ce3fd28432e2eaca7bc7a60046dd8be40)
Change-Id: I34c96adffab3478dae8f5a2597a840caad5092cc
Diffstat (limited to 'liblog')
| -rw-r--r-- | liblog/logprint.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/liblog/logprint.c b/liblog/logprint.c index 3927c22fd..a7480d51e 100644 --- a/liblog/logprint.c +++ b/liblog/logprint.c @@ -1,6 +1,6 @@ /* ** -** Copyright 2006, The Android Open Source Project +** Copyright 2006-2014, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -377,8 +377,13 @@ int android_log_processLogBuffer(struct logger_entry *buf, int msgEnd = -1; int i; + char *msg = buf->msg; + struct logger_entry_v2 *buf2 = (struct logger_entry_v2 *)buf; + if (buf2->hdr_size) { + msg = ((char *)buf2) + buf2->hdr_size; + } for (i = 1; i < buf->len; i++) { - if (buf->msg[i] == '\0') { + if (msg[i] == '\0') { if (msgStart == -1) { msgStart = i + 1; } else { @@ -395,12 +400,12 @@ int android_log_processLogBuffer(struct logger_entry *buf, if (msgEnd == -1) { // incoming message not null-terminated; force it msgEnd = buf->len - 1; - buf->msg[msgEnd] = '\0'; + msg[msgEnd] = '\0'; } - entry->priority = buf->msg[0]; - entry->tag = buf->msg + 1; - entry->message = buf->msg + msgStart; + entry->priority = msg[0]; + entry->tag = msg + 1; + entry->message = msg + msgStart; entry->messageLen = msgEnd - msgStart; return 0; @@ -614,6 +619,10 @@ int android_log_processBinaryLogBuffer(struct logger_entry *buf, * Pull the tag out. */ eventData = (const unsigned char*) buf->msg; + struct logger_entry_v2 *buf2 = (struct logger_entry_v2 *)buf; + if (buf2->hdr_size) { + eventData = ((unsigned char *)buf2) + buf2->hdr_size; + } inCount = buf->len; if (inCount < 4) return -1; |
