00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00031
00032
00033
00034
00035 #ifndef _BROWSER_LOG_H_
00036 #define _BROWSER_LOG_H_
00037
00038 #define BR_LOGGING_ON 0
00039 #define BR_WARNING_ON 1
00040 #define BR_ERROR_ON 1
00041 #define BR_MANIFEST_ON 0
00042 #define BR_PAGEBAR_ON 0
00043 #define BR_IPC_ON 0
00044 #define BR_MOZILLA_DOC_ON 0 //parsing the XHTML DOC
00045 #define BR_DISPLAY_ON 0
00046
00047 #define SYSLOG_ON 1
00048 #if (SYSLOG_ON)
00049 #include <syslog.h>
00050 #endif
00051
00052 #if (BR_LOGGING_ON)
00053 #if (SYSLOG_ON)
00054 #define BR_LOGPRINTF(x, args...) \
00055 {\
00056 syslog(LOG_INFO, "(BR_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00057 fprintf(stderr, "(BR_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00058 }
00059 #else
00060 #define BR_LOGPRINTF(x, args...) fprintf(stderr, "(BR_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00061 #endif
00062 #else
00063 #define BR_LOGPRINTF(x, args...) do {} while (0)
00064 #endif
00065
00066 #if (BR_WARNING_ON)
00067 #if (SYSLOG_ON)
00068 #define BR_WARNPRINTF(x, args...) \
00069 {\
00070 syslog(LOG_WARNING, "(BR_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00071 fprintf(stderr, "(BR_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00072 }
00073 #else
00074 #define BR_WARNPRINTF(x, args...) fprintf(stderr, "(BR_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00075 #endif
00076 #else
00077 #define BR_WARNPRINTF(x, args...) do {} while (0)
00078 #endif
00079
00080 #if (BR_ERROR_ON)
00081 #if (SYSLOG_ON)
00082 #define BR_ERRORPRINTF(x, args...) \
00083 {\
00084 syslog(LOG_ERR, "(BR_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00085 fprintf(stderr, "(BR_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00086 }
00087 #else
00088 #define BR_ERRORPRINTF(x, args...) fprintf(stderr, "(BR_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00089 #endif
00090 #else
00091 #define BR_ERRORPRINTF(x, args...) do {} while (0)
00092 #endif
00093
00094 #if (BR_IPC_ON)
00095 #if (SYSLOG_ON)
00096 #define BR_IPCPRINTF(x, args...) \
00097 {\
00098 syslog(LOG_INFO, "(BR_IP)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00099 fprintf(stderr, "(BR_IP)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00100 }
00101 #else
00102 #define BR_IPCPRINTF(x, args...) fprintf(stderr, "(BR_IP)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00103 #endif
00104 #else
00105 #define BR_IPCPRINTF(x, args...) do {} while (0)
00106 #endif
00107
00108 #if (BR_MANIFEST_ON)
00109 #if (SYSLOG_ON)
00110 #define BR_MANIFESTPRINTF(x, args...) \
00111 {\
00112 syslog(LOG_INFO, "(BR_MA)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00113 fprintf(stderr, "(BR_MA)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00114 }
00115 #else
00116 #define BR_MANIFESTPRINTF(x, args...) fprintf(stderr, "(BR_MA)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00117 #endif
00118 #else
00119 #define BR_MANIFESTPRINTF(x, args...) do {} while (0)
00120 #endif
00121
00122 #if (BR_PAGEBAR_ON)
00123 #if (SYSLOG_ON)
00124 #define BR_PAGEBARPRINTF(x, args...) \
00125 {\
00126 syslog(LOG_INFO, "(BR_PB)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00127 fprintf(stderr, "(BR_PB)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00128 }
00129 #else
00130 #define BR_PAGEBARPRINTF(x, args...) fprintf(stderr, "(BR_PB)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00131 #endif
00132 #else
00133 #define BR_PAGEBARPRINTF(x, args...) do {} while (0)
00134 #endif
00135
00136 #if (BR_MOZILLA_DOC_ON)
00137 #if (SYSLOG_ON)
00138 #define BR_MOZILLA_DOCPRINTF(x, args...) \
00139 {\
00140 syslog(LOG_INFO, "(BR_MO)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00141 fprintf(stderr, "(BR_MO)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00142 }
00143 #else
00144 #define BR_MOZILLA_DOCPRINTF(x, args...) fprintf(stderr, "(BR_MO)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00145 #endif
00146 #else
00147 #define BR_MOZILLA_DOCPRINTF(x, args...) do {} while (0)
00148 #endif
00149
00150 #if (BR_DISPLAY_ON)
00151 #if (SYSLOG_ON)
00152 #define BR_DISPLAYPRINTF(x, args...) \
00153 {\
00154 syslog(LOG_INFO, "(BR_D)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00155 fprintf(stderr, "(BR_D)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00156 }
00157 #else
00158 #define BR_DISPLAYPRINTF(x, args...) fprintf(stderr, "(BR_D)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00159 #endif
00160 #else
00161 #define BR_DISPLAYPRINTF(x, args...) do {} while (0)
00162 #endif
00163
00164 #endif //_BROWSER_LOG_H_