xrootd
XrdPfcTrace.hh
Go to the documentation of this file.
1 #ifndef _XRDPFC_TRACE_H
2 #define _XRDPFC_TRACE_H
3 
4 // Trace flags
5 //
6 #define TRACE_None 0
7 #define TRACE_Error 1
8 #define TRACE_Warning 2
9 #define TRACE_Info 3
10 #define TRACE_Debug 4
11 #define TRACE_Dump 5
12 
13 #define TRACE_STR_None ""
14 #define TRACE_STR_Error "error "
15 #define TRACE_STR_Warning "warning "
16 #define TRACE_STR_Info "info "
17 #define TRACE_STR_Debug "debug "
18 #define TRACE_STR_Dump "dump "
19 
20 #define TRACE_STR_0 ""
21 #define TRACE_STR_1 "error "
22 #define TRACE_STR_2 "warning "
23 #define TRACE_STR_3 "info "
24 #define TRACE_STR_4 "debug "
25 #define TRACE_STR_5 "dump "
26 
27 #ifndef NODEBUG
28 
29 #include "XrdSys/XrdSysHeaders.hh"
30 #include "XrdSys/XrdSysTrace.hh"
31 #include "XrdSys/XrdSysE2T.hh"
32 
33 #ifndef XRD_TRACE
34 #define XRD_TRACE GetTrace()->
35 #endif
36 
37 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << XrdSysE2T(err_code)
38 
39 #define TRACE(act, x) \
40  if (XRD_TRACE What >= TRACE_ ## act) \
41  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
42 
43 #define TRACE_INT(act, x) \
44  if (XRD_TRACE What >= act) \
45  {static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
46  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] << x)}
47 
48 #define TRACE_TEST(act, x) \
49  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
50 
51 #define TRACE_PC(act, pre_code, x) \
52  if (XRD_TRACE What >= TRACE_ ## act) \
53  {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)}
54 
55 #define TRACEIO(act, x) \
56  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
57  TRACE_STR_ ## act << x << " " << GetPath())
58 
59 #define TRACEF(act, x) \
60  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
61  TRACE_STR_ ## act << x << " " << GetLocalPath())
62 
63 #else
64 
65 #define ERRNO_AND_ERRSTR(err_code)
66 #define TRACE(act,x)
67 #define TRACE_PC(act, pre_code, x)
68 #define TRACEIO(act, x)
69 #define TRACEF(act, x)
70 
71 #endif
72 
73 #endif