00001 #ifndef _XRDFILECACHE_TRACE_H
00002 #define _XRDFILECACHE_TRACE_H
00003
00004
00005
00006 #define TRACE_None 0
00007 #define TRACE_Error 1
00008 #define TRACE_Warning 2
00009 #define TRACE_Info 3
00010 #define TRACE_Debug 4
00011 #define TRACE_Dump 5
00012
00013 #define TRACE_STR_None ""
00014 #define TRACE_STR_Error "error "
00015 #define TRACE_STR_Warning "warning "
00016 #define TRACE_STR_Info "info "
00017 #define TRACE_STR_Debug "debug "
00018 #define TRACE_STR_Dump "dump "
00019
00020 #define TRACE_STR_0 ""
00021 #define TRACE_STR_1 "error "
00022 #define TRACE_STR_2 "warning "
00023 #define TRACE_STR_3 "info "
00024 #define TRACE_STR_4 "debug "
00025 #define TRACE_STR_5 "dump "
00026
00027 #ifndef NODEBUG
00028
00029 #include "XrdSys/XrdSysHeaders.hh"
00030 #include "XrdSys/XrdSysTrace.hh"
00031
00032 #ifndef XRD_TRACE
00033 #define XRD_TRACE GetTrace()->
00034 #endif
00035
00036 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << strerror(err_code)
00037
00038 #define TRACE(act, x) \
00039 if (XRD_TRACE What >= TRACE_ ## act) \
00040 SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
00041
00042 #define TRACE_INT(act, x) \
00043 if (XRD_TRACE What >= act) \
00044 {static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
00045 SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] <<x)}
00046
00047 #define TRACE_TEST(act, x) \
00048 SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act <<x)
00049
00050 #define TRACE_PC(act, pre_code, x) \
00051 if (XRD_TRACE What >= TRACE_ ## act) \
00052 {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act <<x)}
00053
00054 #define TRACEIO(act, x) \
00055 if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
00056 TRACE_STR_ ## act <<x <<" " <<GetPath())
00057
00058 #define TRACEF(act, x) \
00059 if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
00060 TRACE_STR_ ## act <<x <<" " <<GetLocalPath())
00061
00062 #else
00063
00064 #define ERRNO_AND_ERRSTR(err_code)
00065 #define TRACE(act,x)
00066 #define TRACE_PC(act, pre_code, x)
00067 #define TRACEIO(act, x)
00068 #define TRACEF(act, x)
00069
00070 #endif
00071
00072 #endif
00073