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 namespace XrdPfc
42 {
43  extern const char *trace_what_strings[];
44 }
45 
46 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << XrdSysE2T(err_code)
47 
48 #define TRACE(act, x) \
49  if (XRD_TRACE What >= TRACE_ ## act) \
50  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
51 
52 #define TRACE_INT(act, x) \
53  if (XRD_TRACE What >= act) \
54  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, trace_what_strings[act] << x)
55 
56 #define TRACE_TEST(act, x) \
57  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
58 
59 #define TRACE_PC(act, pre_code, x) \
60  if (XRD_TRACE What >= TRACE_ ## act) \
61  {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)}
62 
63 #define TRACEIO(act, x) \
64  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
65  TRACE_STR_ ## act << x << " " << obfuscateAuth(GetPath()))
66 
67 #define TRACEF(act, x) \
68  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
69  TRACE_STR_ ## act << x << " " << GetLocalPath())
70 
71 #define TRACEF_INT(act, x) \
72  if (XRD_TRACE What >= act) \
73  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, trace_what_strings[act] << x << " " << GetLocalPath())
74 
75 #else
76 
77 #define ERRNO_AND_ERRSTR(err_code)
78 #define TRACE(act,x)
79 #define TRACE_PC(act, pre_code, x)
80 #define TRACEIO(act, x)
81 #define TRACEF(act, x)
82 #define TRACEF_INT(act, x)
83 
84 #endif
85 
86 #endif
Definition: XrdPfc.hh:41
const char * trace_what_strings[]