00001 #ifndef _XRDPFC_TRACE_H
00002 #define _XRDPFC_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 #include "XrdSys/XrdSysE2T.hh"
00032
00033 #ifndef XRD_TRACE
00034 #define XRD_TRACE GetTrace()->
00035 #endif
00036
00037 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << XrdSysE2T(err_code)
00038
00039 #define TRACE(act, x) \
00040 if (XRD_TRACE What >= TRACE_ ## act) \
00041 SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
00042
00043 #define TRACE_INT(act, x) \
00044 if (XRD_TRACE What >= act) \
00045 {static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
00046 SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] <<x)}
00047
00048 #define TRACE_TEST(act, x) \
00049 SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act <<x)
00050
00051 #define TRACE_PC(act, pre_code, x) \
00052 if (XRD_TRACE What >= TRACE_ ## act) \
00053 {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act <<x)}
00054
00055 #define TRACEIO(act, x) \
00056 if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
00057 TRACE_STR_ ## act <<x <<" " <<GetPath())
00058
00059 #define TRACEF(act, x) \
00060 if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
00061 TRACE_STR_ ## act <<x <<" " <<GetLocalPath())
00062
00063 #else
00064
00065 #define ERRNO_AND_ERRSTR(err_code)
00066 #define TRACE(act,x)
00067 #define TRACE_PC(act, pre_code, x)
00068 #define TRACEIO(act, x)
00069 #define TRACEF(act, x)
00070
00071 #endif
00072
00073 #endif
00074