00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #if defined(HAVE_VARARG_MACROS) && defined(__GNUC__)
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 void rs_log0(int level, char const *fn, char const *fmt, ...)
00050 __attribute__ ((format(printf, 3, 4)));
00051
00052 #ifdef DO_RS_TRACE
00053 # define rs_trace(fmt, arg...) \
00054 do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \
00055 } while (0)
00056 #else
00057 # define rs_trace(fmt, arg...)
00058 #endif
00059
00060 #define rs_log(l, s, str...) do { \
00061 rs_log0((l), __FUNCTION__, (s) , ##str); \
00062 } while (0)
00063
00064
00065 #define rs_error(s, str...) do { \
00066 rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \
00067 } while (0)
00068
00069
00070 #define rs_fatal(s, str...) do { \
00071 rs_log0(RS_LOG_CRIT, __FUNCTION__, \
00072 (s) , ##str); \
00073 abort(); \
00074 } while (0)
00075
00076
00077 #else
00078 # define rs_trace rs_trace0
00079 # define rs_fatal rs_fatal0
00080 # define rs_error rs_error0
00081 # define rs_log rs_log0_nofn
00082 #endif
00083
00084 void rs_trace0(char const *s, ...);
00085 void rs_fatal0(char const *s, ...);
00086 void rs_error0(char const *s, ...);
00087 void rs_log0(int level, char const *fn, char const *fmt, ...);
00088 void rs_log0_nofn(int level, char const *fmt, ...);
00089
00090 enum {
00091 RS_LOG_PRIMASK = 7,
00094 RS_LOG_NONAME = 8
00096 };
00097
00098
00106 extern int rs_trace_level;
00107
00108 #ifdef DO_RS_TRACE
00109 # define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)
00110 #else
00111 # define rs_trace_enabled() 0
00112 #endif