From 3ed7551ce18147740ad1e1113d9d4ca2c01e4248 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Fri, 19 Apr 2013 18:00:03 +0800 Subject: [PATCH] add ANDROID utils --- src/utils.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils.h b/src/utils.h index e8020bac..c9dad763 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,6 +1,15 @@ #ifndef _UTILS_H #define _UTILS_H +#ifdef ANDROID + +#include + +#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, "shadowsocks", __VA_ARGS__)) +#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "shadowsocks", __VA_ARGS__)) + +#else + #define STR(x) #x #define TOSTR(x) STR(x) #define TIME_FORMAT "%F %T" @@ -19,6 +28,8 @@ while(0) fprintf(stderr, "\e[01;35m %s ERROR: \e[0m" format "\n", timestr, ##__VA_ARGS__);}\ while(0) +#endif + void FATAL(const char *msg); void ERROR(const char *s); void usage(void);