aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Grossman <johngro@google.com>2012-04-20 11:45:43 -0700
committerJohn Grossman <johngro@google.com>2012-04-20 11:45:43 -0700
commit6a7ffa31d45635b56558b9ba8bbd05fc002e1fa4 (patch)
tree5f64efdaa2c2f21653850da53e6351c16cc50383
parent1f1ef57e839d72b24bb2f43b602ecf63e1068010 (diff)
downloadexternal_dhcpcd-6a7ffa31d45635b56558b9ba8bbd05fc002e1fa4.zip
external_dhcpcd-6a7ffa31d45635b56558b9ba8bbd05fc002e1fa4.tar.gz
external_dhcpcd-6a7ffa31d45635b56558b9ba8bbd05fc002e1fa4.tar.bz2
DHCPCD: Add the ability to redirect log to logcat.
Add a simple macro hack (turned off by default) to redirect DHCPCD's syslog messages to Android's logcat facility. Useful when debugging DHCPCD issues. Change-Id: I3bf8b97c04aaecb21cee86c0b4e078a7e31672bc Signed-off-by: John Grossman <johngro@google.com>
-rw-r--r--common.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/common.h b/common.h
index fbbfc18..65b060f 100644
--- a/common.h
+++ b/common.h
@@ -79,4 +79,33 @@ void *xmalloc(size_t);
void *xzalloc(size_t);
char *xstrdup(const char *);
+/* Uncomment the #def below to send DHCPCD syslog messages to Android's logcat
+ * instead. */
+/* #define REDIRECT_SYSLOG_TO_ANDROID_LOGCAT */
+#ifdef REDIRECT_SYSLOG_TO_ANDROID_LOGCAT
+
+#define LOG_TAG "DHCPCD"
+#include <utils/Log.h>
+
+#undef LOG_EMERG
+#undef LOG_ALERT
+#undef LOG_CRIT
+#undef LOG_ERR
+#undef LOG_WARNING
+#undef LOG_NOTICE
+#undef LOG_INFO
+#undef LOG_DEBUG
+
+#define LOG_EMERG ANDROID_LOG_FATAL
+#define LOG_ALERT ANDROID_LOG_FATAL
+#define LOG_CRIT ANDROID_LOG_FATAL
+#define LOG_ERR ANDROID_LOG_ERROR
+#define LOG_WARNING ANDROID_LOG_WARN
+#define LOG_NOTICE ANDROID_LOG_WARN
+#define LOG_INFO ANDROID_LOG_INFO
+#define LOG_DEBUG ANDROID_LOG_DEBUG
+#define syslog(a, b...) android_printLog(a, LOG_TAG, b)
+
+#endif /* REDIRECT_SYSLOG_TO_ANDROID_LOGCAT */
+
#endif