00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _PDFVIEWER_LOG_H_
00020 #define _PDFVIEWER_LOG_H_
00021
00022 #define PV_LOGGING_ON 0
00023 #define PV_WARNING_ON 1
00024 #define PV_ERROR_ON 1
00025 #define PV_DUMP_ON 1
00026 #define PV_MEM_ON 1
00027 #define PV_LIST_ON 1
00028 #define PV_PROFILE_ON 1
00029 #define PV_SCB_ON 0
00030 #define PV_TOOLBAR_ON 0
00031
00032 #define SYSLOG_ON 1
00033 #if (SYSLOG_ON)
00034 #include <syslog.h>
00035 #endif
00036
00037 #if (PV_LOGGING_ON)
00038 #if (SYSLOG_ON)
00039 #define PV_LOGPRINTF(x, args...) \
00040 {\
00041 syslog(LOG_INFO, "(PV_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00042 fprintf(stderr, "(PV_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00043 }
00044 #else
00045 #define PV_LOGPRINTF(x, args...) fprintf(stderr, "(PV_L)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00046 #endif
00047 #else
00048 #define PV_LOGPRINTF(x, args...) do {} while (0)
00049 #endif
00050
00051 #if (PV_WARNING_ON)
00052 #if (SYSLOG_ON)
00053 #define PV_WARNPRINTF(x, args...) \
00054 {\
00055 syslog(LOG_WARNING, "(PV_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00056 fprintf(stderr, "(PV_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00057 }
00058 #else
00059 #define PV_WARNPRINTF(x, args...) fprintf(stderr, "(PV_W)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00060 #endif
00061 #else
00062 #define PV_WARNPRINTF(x, args...) do {} while (0)
00063 #endif
00064
00065 #if (PV_ERROR_ON)
00066 #if (SYSLOG_ON)
00067 #define PV_ERRORPRINTF(x, args...) \
00068 {\
00069 syslog(LOG_ERR, "(PV_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00070 fprintf(stderr, "(PV_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00071 }
00072 #else
00073 #define PV_ERRORPRINTF(x, args...) fprintf(stderr, "(PV_E)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00074 #endif
00075 #else
00076 #define PV_ERRORPRINTF(x, args...) do {} while (0)
00077 #endif
00078
00079 #if (PV_DUMP_ON)
00080 #if (SYSLOG_ON)
00081 #define PV_DUMP(x, args...) \
00082 {\
00083 syslog(LOG_INFO, x , ##args);\
00084 fprintf(stderr, x , ##args);\
00085 }
00086 #else
00087 #define PV_DUMP(x, args...) fprintf(stderr, x , ##args)
00088 #endif
00089 #else
00090 #define PV_DUMP(x, args...) do {} while (0)
00091 #endif
00092
00093 #if (PV_LIST_ON)
00094 #if (SYSLOG_ON)
00095 #define PV_LISTPRINTF(x, args...) \
00096 {\
00097 syslog(LOG_INFO, x , ##args);\
00098 fprintf(stderr, x , ##args);\
00099 }
00100 #else
00101 #define PV_LISTPRINTF(x, args...) fprintf(stderr, x , ##args)
00102 #endif
00103 #else
00104 #define PV_LISTPRINTF(x, args...) do {} while (0)
00105 #endif
00106
00107
00108 #if (PV_MEM_ON)
00109 #if (SYSLOG_ON)
00110 #define PV_MEM(x, args...) \
00111 {\
00112 syslog(LOG_INFO, "(PV_M)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00113 fprintf(stderr, "(PV_M)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00114 }
00115 #else
00116 #define PV_MEM(x, args...) fprintf(stderr, "(PV_M)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00117 #endif
00118 #else
00119 #define PV_MEM(x, args...) do {} while(0)
00120 #endif
00121
00122
00123 #if (PV_SCB_ON)
00124 #if (SYSLOG_ON)
00125 #define PV_SCBPRINTF(x, args...) \
00126 {\
00127 syslog(LOG_INFO, "(PV_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00128 fprintf(stderr, "(PV_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00129 }
00130 #else
00131 #define PV_SCBPRINTF(x, args...) fprintf(stderr, "(PV_S)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00132 #endif
00133 #else
00134 #define PV_SCBPRINTF(x, args...) do {} while (0)
00135 #endif
00136
00137
00138 #if (PV_TOOLBAR_ON)
00139 #if (SYSLOG_ON)
00140 #define PV_TBPRINTF(x, args...) \
00141 {\
00142 syslog(LOG_INFO, "(PV_TB)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00143 fprintf(stderr, "(PV_TB)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args);\
00144 }
00145 #else
00146 #define PV_TBPRINTF(x, args...) fprintf(stderr, "(PV_TB)" __FILE__ ":%d,%s() " x "\n", __LINE__, __func__ , ##args)
00147 #endif
00148 #else
00149 #define PV_TBPRINTF(x, args...) do {} while (0)
00150 #endif
00151
00152
00153 #endif //
00154