|
|
@ -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); |
|
|
|