aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2010-02-16 15:20:48 -0800
committerDmitry Shmidt <dimitrysh@google.com>2010-02-16 15:20:48 -0800
commit80545bf964016dd8dfcfa5a1814dd515fa8b2132 (patch)
tree7db8bbca04c313059fbfcd24257a3d49e79c56cf
parenta557a19eed2f9eb8869aeaffca7a6cda076b0770 (diff)
downloadexternal_dhcpcd-80545bf964016dd8dfcfa5a1814dd515fa8b2132.zip
external_dhcpcd-80545bf964016dd8dfcfa5a1814dd515fa8b2132.tar.gz
external_dhcpcd-80545bf964016dd8dfcfa5a1814dd515fa8b2132.tar.bz2
Add dhcpcd Android debug output
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--logger.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/logger.c b/logger.c
index 15c6cf7..46d179a 100644
--- a/logger.c
+++ b/logger.c
@@ -35,6 +35,10 @@
#include "common.h"
#include "logger.h"
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+
static int loglevel = LOG_INFO;
static char logprefix[12] = {0};
@@ -59,6 +63,14 @@ logger(int level, const char *fmt, ...)
char *fmt2, *pf;
va_start(p, fmt);
+#ifdef ANDROID
+ if (level <= LOG_ERR) {
+ level = ANDROID_LOG_ERROR;
+ } else {
+ level = ANDROID_LOG_DEBUG;
+ }
+ __android_log_vprint(level, "dhcpcd", fmt, p);
+#else
va_copy(p2, p);
if (level <= LOG_ERR || level <= loglevel) {
@@ -85,5 +97,6 @@ logger(int level, const char *fmt, ...)
}
va_end(p2);
+#endif
va_end(p);
}