Go to the documentation of this file.
37 #include <sys/types.h>
46 #ifdef HAVE_ISO_VARARGS
69 # ifdef HAVE_ISO_VARARGS
70 # define DBGPRINTF(...) do { time_t clock; struct tm now;\
71 clock = time(0); localtime_r(&clock, &now); \
72 fprintf(stderr,"[%02d/%02d/%04d %02d:%02d:%02d] [%s:%d] [%s] %d DBG: ",\
73 now.tm_mon+1,now.tm_mday,now.tm_year+1900,\
74 now.tm_hour,now.tm_min,now.tm_sec,\
75 __FILE__,__LINE__,__FUNCNAME__, (int)getpid());\
76 fprintf(stderr, __VA_ARGS__); \
77 fflush(stderr); } while (0)
79 # define DBGPRINTF printf("%s: %d [] %d DBG: ", __FILE__ , __LINE__ , -1 )+printf
82 # ifdef HAVE_ISO_VARARGS
83 # define DBGPRINTF(...)
85 static void DBGPRINTF(
const char *format, ...) {}
99 # ifdef HAVE_ISO_VARARGS
100 # define ERRPRINTF(...) do { time_t clock; struct tm now;\
101 clock = time(0); localtime_r(&clock, &now); \
102 fprintf(stderr,"[%02d/%02d/%04d %02d:%02d:%02d] [%s:%d] [%s] %d ERR: ",\
103 now.tm_mon+1,now.tm_mday,now.tm_year+1900,\
104 now.tm_hour,now.tm_min,now.tm_sec,\
105 __FILE__,__LINE__,__FUNCNAME__, (int)getpid()); \
106 fprintf(stderr, __VA_ARGS__); \
107 fflush(stderr); } while (0)
109 # define ERRPRINTF printf
123 # ifdef HAVE_ISO_VARARGS
125 # define LOGPRINTF(...) do { time_t clock; struct tm now;\
126 clock = time(0); localtime_r(&clock, &now); \
127 fprintf(stderr,"[%02d/%02d/%04d %02d:%02d:%02d] [%s:%d] [%s] %d LOG: ",\
128 now.tm_mon+1,now.tm_mday,now.tm_year+1900,\
129 now.tm_hour,now.tm_min,now.tm_sec,\
130 __FILE__,__LINE__,__FUNCNAME__,\
132 fprintf(stderr, __VA_ARGS__); \
133 fflush(stderr); } while (0)
135 # define LOGPRINTF(...) do { time_t clock; struct tm now;\
136 clock = time(0); localtime_r(&clock, &now); \
137 fprintf(stderr,"[%02d/%02d/%04d %02d:%02d:%02d] [%s] %d LOG: ",\
138 now.tm_mon+1,now.tm_mday,now.tm_year+1900,\
139 now.tm_hour,now.tm_min,now.tm_sec,__FUNCNAME__,\
141 fprintf(stderr, __VA_ARGS__); \
142 fflush(stderr); } while (0)
145 # define LOGPRINTF printf
156 # ifdef HAVE_ISO_VARARGS
157 # define SWITCHPRINTF(OUTPUT,...) do { \
158 if(strcmp(OUTPUT,PMM_LOG)==0) {\
159 LOGPRINTF(__VA_ARGS__);\
160 } else if(strcmp(OUTPUT, PMM_ERR)==0) {\
161 ERRPRINTF(__VA_ARGS__);\
162 } else if(strcmp(OUTPUT,PMM_DBG)==0) {\
163 DBGPRINTF(__VA_ARGS__);\
165 LOGPRINTF(__VA_ARGS__);\
169 # define SWITCHPRINTF printf