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 #include "XrdOuc/XrdOucUtils.hh"
37 #ifndef XRD_TRACE
38 #define XRD_TRACE GetTrace()->
39 #endif
40 
41 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << XrdSysE2T(err_code)
42 
43 #define TRACE(act, x) \
44  if (XRD_TRACE What >= TRACE_ ## act) \
45  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
46 
47 #define TRACE_INT(act, x) \
48  if (XRD_TRACE What >= act) \
49  {static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
50  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] << x)}
51 
52 #define TRACE_TEST(act, x) \
53  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
54 
55 #define TRACE_PC(act, pre_code, x) \
56  if (XRD_TRACE What >= TRACE_ ## act) \
57  {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)}
58 
59 #define TRACEIO(act, x) \
60  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
61  TRACE_STR_ ## act << x << " " << obfuscateAuth(GetPath()))
62 
63 #define TRACEF(act, x) \
64  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
65  TRACE_STR_ ## act << x << " " << GetLocalPath())
66 
67 #else
68 
69 #define ERRNO_AND_ERRSTR(err_code)
70 #define TRACE(act,x)
71 #define TRACE_PC(act, pre_code, x)
72 #define TRACEIO(act, x)
73 #define TRACEF(act, x)
74 
75 #endif
76 
77 #endif