mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-30 13:13:44 +00:00
embedded libev
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
#ifndef _UTILS_H
|
||||
#define _UTILS_H
|
||||
|
||||
#define STR(x) #x
|
||||
#define TOSTR(x) STR(x)
|
||||
#define TIME_FORMAT "%F %T"
|
||||
|
||||
#define LOGD(format, ...) do {\
|
||||
time_t now = time(NULL);\
|
||||
char timestr[20];\
|
||||
strftime(timestr, 20, TIME_FORMAT, localtime(&now));\
|
||||
fprintf(stderr, "\e[01;32m %s INFO: \e[0m" format "\n", timestr, ##__VA_ARGS__);}\
|
||||
while(0)
|
||||
|
||||
#define LOGE(format, ...) do {\
|
||||
time_t now = time(NULL);\
|
||||
char timestr[20];\
|
||||
strftime(timestr, 20, TIME_FORMAT, localtime(&now));\
|
||||
fprintf(stderr, "\e[01;35m %s ERROR: \e[0m" format " on File: %s Line: %s\n", timestr, ##__VA_ARGS__, __FILE__, TOSTR(__LINE__));}\
|
||||
while(0)
|
||||
|
||||
#define VERSION "0.9"
|
||||
|
||||
void FATAL(const char *msg);
|
||||
void usage(void);
|
||||
void demonize(const char* path);
|
||||
char *itoa(int i);
|
||||
|
||||
#endif // _UTILS_H
|
||||
Reference in New Issue
Block a user