mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-16 16:54:02 +00:00
fix #128
This commit is contained in:
+8
-2
@@ -54,12 +54,17 @@ FILE *logfile;
|
||||
if (ident != NULL) logfile = fopen(ident, "w+");}\
|
||||
while(0)
|
||||
|
||||
#define CLOSE_LOGFILE do {\
|
||||
if (logfile != NULL) fclose(logfile);}\
|
||||
while(0)
|
||||
|
||||
#define LOGD(format, ...) do {\
|
||||
if (logfile != NULL) {\
|
||||
time_t now = time(NULL);\
|
||||
char timestr[20];\
|
||||
strftime(timestr, 20, TIME_FORMAT, localtime(&now));\
|
||||
fprintf(logfile, " %s INFO: " format "\n", timestr, ##__VA_ARGS__);}\
|
||||
fprintf(logfile, " %s INFO: " format "\n", timestr, ##__VA_ARGS__);\
|
||||
fflush(logfile);}\
|
||||
}\
|
||||
while(0)
|
||||
|
||||
@@ -68,7 +73,8 @@ while(0)
|
||||
time_t now = time(NULL);\
|
||||
char timestr[20];\
|
||||
strftime(timestr, 20, TIME_FORMAT, localtime(&now));\
|
||||
fprintf(logfile, " %s ERROR: " format "\n", timestr, ##__VA_ARGS__);}\
|
||||
fprintf(logfile, " %s ERROR: " format "\n", timestr, ##__VA_ARGS__);\
|
||||
fflush(logfile);}\
|
||||
}\
|
||||
while(0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user