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 #define TRACE_DumpXL 6
13 
14 #define TRACE_STR_None ""
15 #define TRACE_STR_Error "error "
16 #define TRACE_STR_Warning "warning "
17 #define TRACE_STR_Info "info "
18 #define TRACE_STR_Debug "debug "
19 #define TRACE_STR_Dump "dump "
20 #define TRACE_STR_DumpXL "dump "
21 
22 #define TRACE_STR_0 ""
23 #define TRACE_STR_1 "error "
24 #define TRACE_STR_2 "warning "
25 #define TRACE_STR_3 "info "
26 #define TRACE_STR_4 "debug "
27 #define TRACE_STR_5 "dump "
28 #define TRACE_STR_6 "dump "
29 
30 #ifndef NODEBUG
31 
32 #include "XrdSys/XrdSysHeaders.hh"
33 #include "XrdSys/XrdSysTrace.hh"
34 #include "XrdSys/XrdSysE2T.hh"
35 
36 #ifndef XRD_TRACE
37 #define XRD_TRACE GetTrace()->
38 #endif
39 
40 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << XrdSysE2T(err_code)
41 
42 #define TRACE(act, x) \
43  if (XRD_TRACE What >= TRACE_ ## act) \
44  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
45 
46 #define TRACE_INT(act, x) \
47  if (XRD_TRACE What >= act) \
48  {static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
49  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] << x)}
50 
51 #define TRACE_TEST(act, x) \
52  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
53 
54 #define TRACE_PC(act, pre_code, x) \
55  if (XRD_TRACE What >= TRACE_ ## act) \
56  {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)}
57 
58 #define TRACEIO(act, x) \
59  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
60  TRACE_STR_ ## act << x << " " << GetPath())
61 
62 #define TRACEF(act, x) \
63  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
64  TRACE_STR_ ## act << x << " " << GetLocalPath())
65 
66 #else
67 
68 #define ERRNO_AND_ERRSTR(err_code)
69 #define TRACE(act,x)
70 #define TRACE_PC(act, pre_code, x)
71 #define TRACEIO(act, x)
72 #define TRACEF(act, x)
73 
74 #endif
75 
76 #endif