From 91e0dd85e815dddf0878c97b55624a1c7b84b1f1 Mon Sep 17 00:00:00 2001 From: Matevz Tadel Date: Fri, 17 Jun 2016 00:45:17 -0700 Subject: [PATCH] Improve printing of Location() in Info trace. --- src/XrdFileCache/XrdFileCache.cc | 5 +++-- src/XrdFileCache/XrdFileCacheIO.cc | 5 +++-- src/XrdFileCache/XrdFileCacheTrace.hh | 11 ++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/XrdFileCache/XrdFileCache.cc b/src/XrdFileCache/XrdFileCache.cc index 29dae2819da..26fc24c17fa 100644 --- a/src/XrdFileCache/XrdFileCache.cc +++ b/src/XrdFileCache/XrdFileCache.cc @@ -155,8 +155,9 @@ XrdOucCacheIO2 *Cache::Attach(XrdOucCacheIO2 *io, int Options) else cio = new IOEntireFile(io, m_stats, *this); - TRACE(Info, "Cache::Attach() " << io->Path() << " location: " << - (io->Location() && io->Location()[0] != 0) ? io->Location() : ""); + TRACE_PC(Info, const char* loc = io->Location(), + "Cache::Attach() " << io->Path() << " location: " << + ((loc && loc[0] != 0) ? loc : "")); return cio; } else diff --git a/src/XrdFileCache/XrdFileCacheIO.cc b/src/XrdFileCache/XrdFileCacheIO.cc index 142c028a6f6..6e00288544b 100644 --- a/src/XrdFileCache/XrdFileCacheIO.cc +++ b/src/XrdFileCache/XrdFileCacheIO.cc @@ -13,8 +13,9 @@ m_statsGlobal(stats), m_cache(cache), m_traceID("IO"), m_io(io) void IO::Update(XrdOucCacheIO2 &iocp) { SetInput(&iocp); - TRACE(Info, "IO::Update() " << Path() << " location: " << - (Location() && Location()[0] != 0) ? Location() : ""); + TRACE_PC(Info, const char* loc = Location(), + "IO::Update() " << Path() << " location: " << + ((loc && loc[0] != 0) ? loc : "")); } void IO::SetInput(XrdOucCacheIO2* x) diff --git a/src/XrdFileCache/XrdFileCacheTrace.hh b/src/XrdFileCache/XrdFileCacheTrace.hh index 9bf4e44ecd4..55118f5e4b2 100644 --- a/src/XrdFileCache/XrdFileCacheTrace.hh +++ b/src/XrdFileCache/XrdFileCacheTrace.hh @@ -31,6 +31,10 @@ if (XRD_TRACE What >= TRACE_ ## act) \ {XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <= TRACE_ ## act) \ + {pre_code; XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <= TRACE_ ## act) \ {XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <= TRACE_ ## act) \ {XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act << x << " " << GetLocalPath(); XRD_TRACE End();} - - - #else #define TRACE(act,x) +#define TRACE_PC(act, pre_code, x) +#define TRACEIO(act, x) +#define TRACEF(act, x) + #endif #endif