00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00030
00031
00032
00033
00034
00035
00036 #ifndef _ERIPCLOG_H_
00037 #define _ERIPCLOG_H_
00038
00039 #define ERIPC_LOGGING_ON 0
00040 #define ERIPC_WARNING_ON 1
00041 #define ERIPC_ERROR_ON 1
00042
00043 #define SYSLOG_ON 1
00044 #if (SYSLOG_ON)
00045 #include <syslog.h>
00046 #endif
00047
00048 #if (ERIPC_LOGGING_ON)
00049 #if (SYSLOG_ON)
00050 #define ERIPC_LOGPRINTF(x, args...) \
00051 {\
00052 syslog(LOG_INFO, "(L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00053 fprintf(stderr, "(L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00054 }
00055 #else
00056 #define ERIPC_LOGPRINTF(x, args...) fprintf(stderr, "(L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00057 #endif
00058 #else
00059 #define ERIPC_LOGPRINTF(x, args...) do {} while (0)
00060 #endif
00061
00062 #if (ERIPC_WARNING_ON)
00063 #if (SYSLOG_ON)
00064 #define ERIPC_WARNPRINTF(x, args...) \
00065 {\
00066 syslog(LOG_WARNING, "(W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00067 fprintf(stderr, "(W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00068 }
00069 #else
00070 #define ERIPC_WARNPRINTF(x, args...) fprintf(stderr, "(W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00071 #endif
00072 #else
00073 #define ERIPC_WARNPRINTF(x, args...) do {} while (0)
00074 #endif
00075
00076 #if (ERIPC_ERROR_ON)
00077 #if (SYSLOG_ON)
00078 #define ERIPC_ERRORPRINTF(x, args...) \
00079 {\
00080 syslog(LOG_ERR, "(E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00081 fprintf(stderr, "(E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00082 }
00083 #else
00084 #define ERIPC_ERRORPRINTF(x, args...) fprintf(stderr, "(E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00085 #endif
00086 #else
00087 #define ERIPC_ERRORPRINTF(x, args...) do {} while (0)
00088 #endif
00089
00090 #endif