Skip to content

Commit

Permalink
Improve printing of Location() in Info trace.
Browse files Browse the repository at this point in the history
  • Loading branch information
osschar authored and abh3 committed Jun 30, 2016
1 parent ef14496 commit 91e0dd8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -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() : "<deferred open>");
TRACE_PC(Info, const char* loc = io->Location(),
"Cache::Attach() " << io->Path() << " location: " <<
((loc && loc[0] != 0) ? loc : "<deferred open>"));
return cio;
}
else
Expand Down
5 changes: 3 additions & 2 deletions src/XrdFileCache/XrdFileCacheIO.cc
Expand Up @@ -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() : "<not set>");
TRACE_PC(Info, const char* loc = Location(),
"IO::Update() " << Path() << " location: " <<
((loc && loc[0] != 0) ? loc : "<not set>"));
}

void IO::SetInput(XrdOucCacheIO2* x)
Expand Down
11 changes: 8 additions & 3 deletions src/XrdFileCache/XrdFileCacheTrace.hh
Expand Up @@ -31,6 +31,10 @@
if (XRD_TRACE What >= TRACE_ ## act) \
{XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <<x; XRD_TRACE End();}

#define TRACE_PC(act, pre_code, x) \
if (XRD_TRACE What >= TRACE_ ## act) \
{pre_code; XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <<x; XRD_TRACE End();}

#define TRACEIO(act, x) \
if (XRD_TRACE What >= TRACE_ ## act) \
{XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <<x << " " << GetPath(); XRD_TRACE End();}
Expand All @@ -39,12 +43,13 @@
if (XRD_TRACE What >= 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

0 comments on commit 91e0dd8

Please sign in to comment.