00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00033 #ifndef _CONNECTION_MGR_LOG_H_
00034 #define _CONNECTION_MGR_LOG_H_
00035
00036 #include <stdio.h>
00037
00038 #define CN_DISPLAY_ON 0
00039 #define CN_LOGGING_ON 0
00040 #define CN_WARNING_ON 1
00041 #define CN_ERROR_ON 1
00042 #define CN_SELECTION_ON 0
00043 #define CN_LANGUAGE_ON 0
00044 #define CN_STORE_ON 1
00045 #define CN_IPC_ON 0
00046
00047 #define SYSLOG_ON 1
00048
00049 #if (SYSLOG_ON)
00050 #include <syslog.h>
00051 #endif
00052
00053 #if (CN_DISPLAY_ON)
00054 #if (SYSLOG_ON)
00055 #define CN_DMPRINTF(x, args...) \
00056 {\
00057 syslog(LOG_INFO, "(CN_D)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00058 fprintf(stderr, "(CN_D)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00059 }
00060 #else
00061 #define CN_DMPRINTF(x, args...) fprintf(stderr, "(CN_D)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00062 #endif
00063 #else
00064 #define CN_DMPRINTF(x, args...) do {} while (0)
00065 #endif
00066
00067 #if (CN_STORE_ON)
00068 #if (SYSLOG_ON)
00069 #define CN_STOREPRINTF(x, args...) \
00070 {\
00071 syslog(LOG_INFO, "(CN_ST)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00072 fprintf(stderr, "(CN_ST)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00073 }
00074 #else
00075 #define CN_STOREPRINTF(x, args...) fprintf(stderr, "(CN_ST)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00076 #endif
00077 #else
00078 #define CN_STOREPRINTF(x, args...) do {} while (0)
00079 #endif
00080
00081 #if (CN_SELECTION_ON)
00082 #if (SYSLOG_ON)
00083 #define CN_SELPRINTF(x, args...) \
00084 {\
00085 syslog(LOG_INFO, "(CN_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00086 fprintf(stderr, "(CN_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00087 }
00088 #else
00089 #define CN_SELPRINTF(x, args...) fprintf(stderr, "(CN_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00090 #endif
00091 #else
00092 #define CN_SELPRINTF(x, args...) do {} while (0)
00093 #endif
00094
00095 #if (CN_LANGUAGE_ON)
00096 #if (SYSLOG_ON)
00097 #define CN_LANGUAGEPRINTF(x, args...) \
00098 {\
00099 syslog(LOG_INFO, "(CN_LA)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00100 fprintf(stderr, "(CN_LA)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00101 }
00102 #else
00103 #define CN_LANGUAGEPRINTF(x, args...) fprintf(stderr, "(CN_LA)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00104 #endif
00105 #else
00106 #define CN_LANGUAGEPRINTF(x, args...) do {} while (0)
00107 #endif
00108
00109 #if (CN_LOGGING_ON)
00110 #if (SYSLOG_ON)
00111 #define CN_LOGPRINTF(x, args...) \
00112 {\
00113 syslog(LOG_INFO, "(CN_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00114 fprintf(stderr, "(CN_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00115 }
00116 #else
00117 #define CN_LOGPRINTF(x, args...) fprintf(stderr, "(CN_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00118 #endif
00119 #else
00120 #define CN_LOGPRINTF(x, args...) do {} while (0)
00121 #endif
00122
00123 #if (CN_WARNING_ON)
00124 #if (SYSLOG_ON)
00125 #define CN_WARNPRINTF(x, args...) \
00126 {\
00127 syslog(LOG_WARNING, "(CN_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00128 fprintf(stderr, "(CN_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00129 }
00130 #else
00131 #define CN_WARNPRINTF(x, args...) fprintf(stderr, "(CN_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00132 #endif
00133 #else
00134 #define CN_WARNPRINTF(x, args...) do {} while (0)
00135 #endif
00136
00137 #if (CN_ERROR_ON)
00138 #if (SYSLOG_ON)
00139 #define CN_ERRORPRINTF(x, args...) \
00140 {\
00141 syslog(LOG_ERR, "(CN_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00142 fprintf(stderr, "(CN_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00143 }
00144 #else
00145 #define CN_ERRORPRINTF(x, args...) fprintf(stderr, "(CN_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00146 #endif
00147 #else
00148 #define CN_ERRORPRINTF(x, args...) do {} while (0)
00149 #endif
00150
00151 #if (CN_IPC_ON)
00152 #if (SYSLOG_ON)
00153 #define CN_IPCPRINTF(x, args...) \
00154 {\
00155 syslog(LOG_INFO, "(CN_I)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00156 fprintf(stderr, "(CN_I)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00157 }
00158 #else
00159 #define CN_IPCPRINTF(x, args...) fprintf(stderr, "(CN_I)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00160 #endif
00161 #else
00162 #define CN_IPCPRINTF(x, args...) do {} while (0)
00163 #endif
00164
00165 #endif //_CONNECTION_MGR_LOG_H_
00166