00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00036 #ifndef _SETTINGS_APP_LOG_H_
00037 #define _SETTINGS_APP_LOG_H_
00038
00039 #define ST_LOGGING_ON 0
00040 #define ST_WARNING_ON 1
00041 #define ST_ERROR_ON 1
00042 #define ST_SELECTION_ON 0
00043 #define ST_LANGUAGE_ON 0
00044 #define ST_STORE_ON 1
00045 #define ST_IPC_ON 0
00046 #define ST_SCREEN_ON 0
00047
00048 #define SYSLOG_ON 1
00049 #if (SYSLOG_ON)
00050 #include <syslog.h>
00051 #endif
00052
00053 #if (ST_STORE_ON)
00054 #if (SYSLOG_ON)
00055 #define ST_STOREPRINTF(x, args...) \
00056 {\
00057 syslog(LOG_INFO, "(S_ST)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00058 fprintf(stderr, "(S_ST)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00059 }
00060 #else
00061 #define ST_STOREPRINTF(x, args...) fprintf(stderr, "(S_ST)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00062 #endif
00063 #else
00064 #define ST_STOREPRINTF(x, args...) do {} while (0)
00065 #endif
00066
00067 #if (ST_SELECTION_ON)
00068 #if (SYSLOG_ON)
00069 #define ST_SELPRINTF(x, args...) \
00070 {\
00071 syslog(LOG_INFO, "(S_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00072 fprintf(stderr, "(S_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00073 }
00074 #else
00075 #define ST_SELPRINTF(x, args...) fprintf(stderr, "(S_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00076 #endif
00077 #else
00078 #define ST_SELPRINTF(x, args...) do {} while (0)
00079 #endif
00080
00081 #if (ST_LANGUAGE_ON)
00082 #if (SYSLOG_ON)
00083 #define ST_LANGUAGEPRINTF(x, args...) \
00084 {\
00085 syslog(LOG_INFO, "(S_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00086 fprintf(stderr, "(S_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00087 }
00088 #else
00089 #define ST_LANGUAGEPRINTF(x, args...) fprintf(stderr, "(S_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00090 #endif
00091 #else
00092 #define ST_LANGUAGEPRINTF(x, args...) do {} while (0)
00093 #endif
00094
00095 #if (ST_LOGGING_ON)
00096 #if (SYSLOG_ON)
00097 #define ST_LOGPRINTF(x, args...) \
00098 {\
00099 syslog(LOG_INFO, "(S_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00100 fprintf(stderr, "(S_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00101 }
00102 #else
00103 #define ST_LOGPRINTF(x, args...) fprintf(stderr, "(S_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00104 #endif
00105 #else
00106 #define ST_LOGPRINTF(x, args...) do {} while (0)
00107 #endif
00108
00109 #if (ST_WARNING_ON)
00110 #if (SYSLOG_ON)
00111 #define ST_WARNPRINTF(x, args...) \
00112 {\
00113 syslog(LOG_WARNING, "(S_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00114 fprintf(stderr, "(S_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00115 }
00116 #else
00117 #define ST_WARNPRINTF(x, args...) fprintf(stderr, "(S_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00118 #endif
00119 #else
00120 #define ST_WARNPRINTF(x, args...) do {} while (0)
00121 #endif
00122
00123 #if (ST_ERROR_ON)
00124 #if (SYSLOG_ON)
00125 #define ST_ERRORPRINTF(x, args...) \
00126 {\
00127 syslog(LOG_ERR, "(S_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00128 fprintf(stderr, "(S_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00129 }
00130 #else
00131 #define ST_ERRORPRINTF(x, args...) fprintf(stderr, "(S_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00132 #endif
00133 #else
00134 #define ST_ERRORPRINTF(x, args...) do {} while (0)
00135 #endif
00136
00137 #if (ST_IPC_ON)
00138 #if (SYSLOG_ON)
00139 #define ST_IPCPRINTF(x, args...) \
00140 {\
00141 syslog(LOG_INFO, "(S_I)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00142 fprintf(stderr, "(S_I)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00143 }
00144 #else
00145 #define ST_IPCPRINTF(x, args...) fprintf(stderr, "(S_I)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00146 #endif
00147 #else
00148 #define ST_IPCPRINTF(x, args...) do {} while (0)
00149 #endif
00150
00151 #endif //_SETTINGS_APP_LOG_H_