xrootd
XrdFileCacheTrace.hh
Go to the documentation of this file.
1 #ifndef _XRDFILECACHE_TRACE_H
2 #define _XRDFILECACHE_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 
32 #ifndef XRD_TRACE
33 #define XRD_TRACE GetTrace()->
34 #endif
35 
36 #define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << strerror(err_code)
37 
38 #define TRACE(act, x) \
39  if (XRD_TRACE What >= TRACE_ ## act) \
40  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
41 
42 #define TRACE_INT(act, x) \
43  if (XRD_TRACE What >= act) \
44  {static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
45  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] <<x)}
46 
47 #define TRACE_TEST(act, x) \
48  SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act <<x)
49 
50 #define TRACE_PC(act, pre_code, x) \
51  if (XRD_TRACE What >= TRACE_ ## act) \
52  {pre_code; SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act <<x)}
53 
54 #define TRACEIO(act, x) \
55  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
56  TRACE_STR_ ## act <<x <<" " <<GetPath())
57 
58 #define TRACEF(act, x) \
59  if (XRD_TRACE What >= TRACE_ ## act) SYSTRACE(XRD_TRACE, 0, m_traceID, 0, \
60  TRACE_STR_ ## act <<x <<" " <<GetLocalPath())
61 
62 #else
63 
64 #define ERRNO_AND_ERRSTR(err_code)
65 #define TRACE(act,x)
66 #define TRACE_PC(act, pre_code, x)
67 #define TRACEIO(act, x)
68 #define TRACEF(act, x)
69 
70 #endif
71 
72 #endif
73