add ANDROID utils

This commit is contained in:
Max Lv
2013-04-19 18:00:44 +08:00
parent d5b4884e13
commit 3ed7551ce1
+11
View File
@@ -1,6 +1,15 @@
#ifndef _UTILS_H
#define _UTILS_H
#ifdef ANDROID
#include <android/log.h>
#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);